Transfer Function
Transfer Function
4.1 INTRODUCTION
Transfer functions (TF) are frequently used to characterize the input-output relationships or systems that can be described by Linear Time-Invariant (LTI) differential equations.
Transfer Function (TF). The transfer function (TF) of a LTI differential-equation system is defined as the ratio of the Laplace transform (LT) of the output (response function) to the Laplace transform (LT) of the input (driving function) under the assumption that all initial conditions are zero.
Consider the LTI system defined by the differential equation
& + an y = b0 x + b1 x + L + bm 1 x & + bm x a0 y + a1 y + L + an 1 y
where
(n)
( n 1 )
(m)
( m 1 )
(n m)
(4-1)
Laplace-transformed output to the Laplace-transformed input when all initial conditions are zero, or
Transfer Function (TF) = G ( s ) =
L [ output ] L [ input ]
m
zero initial conditions
Y (s) X (s)
b0 s + b1 s
n
m 1
+ L + b m 1 s + b m + L + a n 1 s + a n
(4-2)
a0 s + a1 s
n 1
1/26
X (s ) 142 4 3
In p u t
Y (s ) 1 424 3
Output
14 4424 4 4 3
Transfer Function
Figure 4-1. Block diagram representation of a transfer function
The applicability of the concept of the Transfer Function (TF) is limited to LTI differential equation systems. The following list gives some important comments concerning the TF of a system described by a LTI differential equation: 1. The TF of a system is a mathematical model of that system, in that it is an operational method of expressing the differential equation that relates the output variable to the input variable. 2. The TF is a property of a system itself, unrelated to the magnitude and nature of the input or driving function. 3. The TF includes the units necessary to relate the input to the output; however it does not provide any information concerning the physical structure of the system. (The TF of many physically different systems can be identified). 4. if the TF of a system is known , the output or response can be studied for various forms of inputs with a view toward understanding the nature of the system. 5. If the TF of a system is unknown, it may be established experimentally by introducing known inputs and studying the output of the system. Once established, a TF gives a full description of the dynamic characteristics of the system, as distinct from its physical description Example 4-1 Consider the mechanical system shown in Figure 4-2. The displacement x of the mass m is measured from the equilibrium position. In this system, the external force
& kx bx
m
f (t )
is input and
is the
f (t)
output. i) The FBD is shown in the Fig. 4-2. ii) Apply Newtons second law of motion to a system in translation:
+x
f (t)
2/26
F {
&& = mx
& k x = mx && f (t ) b x
or
&& + b x & + k x = f (t ) mx
iii)
For zero Initial Conditions (I.Cs), taking Laplace Transform (LT) of both sides of the above equation yields
(m s
where
+ b s + k ) X ( s ) = F( s )
and
X (s) = L x ( t )
X (s) F(s)
F (s ) 1 42 4 3
In p u t
Output Input
(m s
+bs+k
X ( s) 1 4 24 3
Output
1 ms 2 + bs + k
1 4 4424 4 4 3
Transfer Function
Y (s) X(s)
is the LT of the output
X (s)
x (t )
and
Y (s)
y (t )
(4-3)
and where we assume all I.Cs involved are zero. It follows that
Y ( s ) = G ( s ) X(s )
Now, consider the output (response) of the system to a unit-impulse input when all the I.Cs are zero. Since
(t )
L ( t ) =1
the LT of the output of the system is
3/26
Y (s) = G (s)
(4-4)
The inverse LT of the output of the system is given by Equation 4-4 yields the impulse response of the system, i.e;
L -1 G ( s ) = g (t )
is called the impulse response function or the weighting function, of the system. The impulse-response function
g (t )
g (t )
Figure 4-3 shows an element of a BD. The arrowhead pointing toward the block indicates the input to the block, and the arrowhead leading away from the block represents the output of the block. As mentioned, such arrows represent signals.
R (s )
G (s )
C ( s ) = R ( s )G ( s )
C (s )
Figure 4-3
Note that
4/26
[ Dimension of the output signal ] = [ Dimension of the input signal ] [ Dimension of the TF ]
Notice that in BD the main source of energy is not explicitly shown and that the BD of a given system is not unique. A number of different BDs can be drawn for a system, depending on the point of view of the analysis (See Example 4-2).
Summing Point. Figure 4-4 shows a circle with a cross, the symbol that
stands for a summing operation. The
(+)
or
()
whether the associated signal is to be added or subtracted. It is important that the quantities being added or subtracted have the same dimensions and the same units.
a
Figure 4-4
a b
b
Summing point.
Branch Point. A branch point is a point from which the signal from a block goes concurrently to other blocks or summing points. Block Diagram of a closed-loop system.
closed loop system. The output compared to the input
C (s )
The
Figure 4-5 is a BD of
R(s) .
closed loop nature of the system is indicated clearly by the figure. The output
C (s )
is
obtained
by
R (s )
E (s )
G (s )
C (s )
G(s ) E(s) .
by the
Figure 4-5
Any linear system can be represented by a BD consisting of blocks, summing points, and branch points. When the output is fed back to the summing point for comparison with the input, it is necessary to convert the form of the output signal to that of the input signal. This conversion is accomplished by the feedback element whose transfer function is
H (s) ,
feedback element is to modify the output before it is compared with the input. In the figure, the feedback signal that is fed back to the summing point for comparison with the input is
B(s ) = H (s ) C (s ) .
5/26
R (s )
E (s )
G (s )
C (s )
B (s )
H (s )
Figure 4-6 Block Diagram of a closed loop-system with feedback element.
6/26
7/26
MATLAB Implementation
Series Connection
R (s)
G1 (s )
G2 (s)
C (s)
T (s) =
C ( s ) num = R ( s ) den
G1 ( s ) =
num1 den1
G2 (s) =
num2 den2
[num,den]=series(num1,den1,num2,den2)
Parallel Connection
G1 (s)
R (s) G2 (s)
C (s)
T (s) =
C ( s ) num = R( s ) den
G1 ( s ) =
num1 den1
G2 (s) =
num2 den2
[num,den]=parallel(num1,den1,num2,den2)
Feedback Connection
R GG (s ) 1 H (s) C
T (s) =
C ( s ) num = R( s) den
G (s) =
num1 den1
H (s) =
num2 den2
+1 -1
[num,den] = feedback(num1,den1,num2,den2,sign)
8/26
This system is represented as two arrays, each containing the coefficients of the polynomials in descending powers of s as follows >> num=25; >> den=[1 4 25]; >> sys=tf(num,den) MATLAB will automatically respond with the display Transfer function: 25 -------------s^2 + 4 s + 25
Partial-Fraction Expansion with MATLAB. MATLAB allows us to obtain the partial-fraction expansion of the ratio of two polynomials,
B(s) A(s)
num den
a (1) s + a ( 2 ) s
n
b (1) s + b ( 2 ) s
h
h 1 n 1
+L + b (h)
( )
+ L + a (n)
vectors that specify the numerator and denominator of B ( s ) A ( s ) . That is, >> num=[b(1) >> den =[a(1) The command >> [r,pk]=residue(num,den); Finds the residues, poles and direct terms of a partial fraction expansion of the ratio of the two polynomials B ( s ) and A ( s ) . The partial fraction expansion of B ( s ) A ( s ) is given by b(2) a(2) . . b(h)]; a(h)];
9/26
B(s) A(s)
num den
s + 8s + 16s + 9s + 6
4 3
s + 6s + 11s + 6
3
>> num=[1 8 16 9 6]; >> den=[1 6 11 6]; >> [r,p,k]=residue(num,den) gives the residues r , poles p and direct terms k as follows r=-6.0000 -4.0000 3.0000 p=-3.0000 -2.0000 -1.0000 k= 1 2
B(s) A(s)
num den
s + 8s + 16s + 9s + 6
4 3
s + 6s + 11s + 6
3
= s+2
6 s+3
4 s+2
3 s+1
The command [num,den]=residue(r,p,k) where r,p and k are outputs , converts the partial-fraction expansion back to the polynomial ratio B ( s ) A ( s ) as shown below >> >> >> >> r =[-6 -4 3]; p =[-3 -2 -1]; k=[1 2]; [num,den]=residue(r,p,k)
num = 1 den = 1 6 11 6 8 16 9 6
Example 4-3 (Textbook Page 114-115) Consider the spring-mass-dashpot system mounted on a massless cart as shown in Figure 4-7.
10/26
1. Obtain the mathematical model of the system. 2. If m = 10 kg , b = 20 N-s/m and k = 100 N/m . Find the response y ( t ) for a unit step input.
y
k
& u &) b( y
k ( y u)
m
b
Figure 4-7
F {
or
The latter equation represents the mathematical model of the system under consideration. 2. For zero I. Cs, taking LT of both sides of the above equation gives
( ms
+ b s + k ) Y ( s ) = ( bs + k ) U ( s )
Y (s)
to
U (s)
Y (s) ( bs + k ) = U ( s ) ( ms 2 + b s + k )
3. Next, we shall obtain analytical solution of the response to the unit-step input. Substituting the given numerical values for the mass, spring and dashpot elements gives
U (s) =
The output
Y (s)
1 s
becomes
Y (s) =
1 2s + 10 2s + 10 = s s 2 + 2 s + 10 s3 + 2 s 2 + 10s
4. To obtain the inverse LT of fractions. Use MATLAB for that >> num=[2 10]; >> den=[1 2 10 0]; >> [r,p,k]=residue(num,den) r= -0.5000 - 0.1667i -0.5000 + 0.1667i 1.0000 p= -1.0000 + 3.0000i -1.0000 - 3.0000i 0 k= [] Therefore,
Y ( s ) , we need to express Y ( s )
into partial
Y (s)
becomes
Y (s) =
Since
Y (s)
Then
Y (s)
12/26
Y (s)
is obtained as
x ( t ) is the output.
1. Obtain the transfer function of the system. 2. If m = 0.1 kg , b2 = 0.4 N-s/m and k1 = 6 N/m , k2 = 4 N/m , and p(t ) is a step force of magnitude 10 N , obtain an analytical solution of x ( t ) .
& b2 y
b2
m2
k2 ( y x)
k1
p(t )
k2 y
k1 x
m
x
p (t )
Figure 4-8 Mechanical system and its FBD.
1. Put a fictitious mass m2 . 2. Draw the FBD as shown. 3. Apply Newton second for translational motion for mass m
13/26
F {
&& p ( t ) k1 x + k2 ( y x ) = m x && = mx
or
&& + ( k1 + k2 ) x k2 y = p(t ) mx
m2
(1)
F {
&& b2 y & k2 ( y x ) = 0 = m2 y
& + k2 y ) = 0 k2 x + ( b2 y
2 ms + ( k1 + k2 ) X ( s ) k2Y ( s ) = P(s ) k2 X ( s ) + [ b2 s + k2 ]Y ( s ) = 0
or
(2)
5. For zero I. Cs taking LT of both sides of Eqs. (1) and (2), gives (3) (4)
X (s)
and
Y ( s ) .1
Y (s)
gives
Y (s) =
k2 X (s) b s + k [ 2 2]
(5)
2 k2 ms + ( k1 + k2 ) X ( s ) [ b s + k ] X ( s ) = P(s ) 2 2
or
which represents a third order system. 8. Next, we shall obtain analytical solution of the response to a step input of magnitude 10 N . Substituting the given numerical values for the mass, springs and dashpot elements gives
1
U (s) =
The output
X (s)
10 s
becomes
X ( s ) , we need to express X ( s )
into partial
fractions. Use MATLAB for that >> num=[100 1000]; >> den=[1 10 100 600 >> [r,p,k]=residue(num,den) r= -0.6845 + 0.2233i -0.6845 - 0.2233i -0.2977 1.6667 p= -1.2898 + 8.8991i -1.2898 - 8.8991i -7.4204 0 k= [] Therefore, 0];
X (s)
becomes
15/26
X (s) =
0.6845 + j 0.2233 0.6845 j 0.2233 0.2977 1.6667 + + s s + 1.2898 j8.8991 s + 1.2898 + j8.8991 s + 7.4204
X (s)
is obtained as
1.2898t x(t ) = L -1 cos ( 8.8991t ) X ( s ) = 1.3690 e 3.9743 1.2898t e sin ( 8.8991t ) 0.2977 e 7.4204t + 1.6667 . 8.8991 123 =0.4466
From the preceding examples, we have seen that once the TF by taking the inverse LT of
of a system is obtained, the response of the system to any input can be determined
X ( s ) , or
-1 x(t ) = L -1 X ( s ) =L G ( s ) U ( s )
G (s)
U (s)
G (s)
of the
time. Unless, for some reason, the analytical solution is needed, we should use a computer to get a numerical solution.
4.2
TRANSIENT RESPONSE ANALYSIS WITH MATLAB MATLAB Representation of Transfer-Functions (TF) Systems. Figure 4-9 shows a block with a TF. Such a block represents a system or an element of a system. To simplify our presentation, we shall call the block with a TF a system. MATLAB uses sys to represent such a system. The statement >> sys=tf(num,den) represents the system. For example, consider the system
Y (s) 2s + 25 = 2 X ( s ) s + 4s + 25
This system is represented as two arrays, each containing the coefficients of the polynomials in descending powers of s as follows >> num=[2 25];
16/26
>> den=[1 4 25]; >> sys=tf(num,den) MATLAB will automatically respond with the display Transfer function: 2 s + 25 -------------s^2 + 4 s + 25 Step Response. The step function plots the unit step response, assuming the I.Cs are zero. The basic syntax is step(sys), where sys is the LTI object defined previously. The basic syntax commands are summarized below Command (Basic Syntax) >> step(sys) Use generates a plot of a unit step response and displays a response curve on the screen. The computation time interval t and the time span of the response tf are determined automatically by MATLAB. generates a plot of a unit step response and displays a response curve on the screen for the specified final time tf . The computation time interval t is determined automatically by MATLAB. generates a plot of a unit step response and displays a response curve on the screen for the user specified time t where t = 0 : t : tf . Returns the output y, and the time array t used for the simulation. No plot is drawn. The array y is p q m where p is length(t), q is the number of outputs, and
>> step(sys,tf)
>> step(sys,t)
>> [y,t]=step(sys,)
The steady state response and the time to reach that steady state are automatically determined. The steady state response is indicated by horizontal dotted line. For more details in this topic: type doc step or help step at MATLAB prompt >> Example 4-5 (Textbook Page 121-122)
17/26
Consider again the spring-mass-dashpot system mounted on a cart as shown in Figure 4-7. (See Example 4-3). The transfer function of the system is
Y (s) ( bs + k ) = U ( s ) ( ms 2 + b s + k )
For m = 10 kg , b = 20 N-s/m and k = 100 N/m . Find the response y ( t ) for a unit step input u(t ) = 1(t ) . MATLAB PROGRAM: >> >> >> >> >> >> m=10; b=20; k=100; num=[b k]; den=[m b k]; sys=tf(num,den); step(sys) grid
Step Response 1.5
Amplitude 0.5 0 0
3 Time (sec)
Example 4-6 (Textbook Page 123-124) Consider again the mechanical system shown in Figure 4-8. (See Example 44). The transfer functions of the system are (See Appendix)
18/26
MATLAB PROGRAM: >> >> >> >> >> >> >> >> >> m=0.1; b2=0.4; k1=6;k2=4; num1=[b2 k2] num2=[k2] den=[m*b2 m*k2 k1*b2+k2*b2 sys1=tf(num1,den) sys2=tf(num2,den) step(10*sys1,'r:',10*sys2,'b') grid gtext('x(t)');gtext('y(t)')
k1*k2]
Step Response 3
x(t)
2.5
y(t)
2
Amplitude
1.5
0.5
0.5
1.5
2.5
3.5
4.5
Time (sec)
Figure 4-11 Step response curves x ( t ) and y ( t ) Impulse Response. The impluse function plots the unit-impulse response, assuming the I.Cs are zero. The basic syntax is impulse(sys), where sys is the LTI object. The basic syntax commands are summarized below Command (Basic Syntax) Use
19/26
>> impulse(sys)
generates a plot of a unit impulse response and displays a response curve on the screen. The computation time interval t and the time span of the response tf are determined automatically by MATLAB. generates a plot of a unit impulse response and displays a response curve on the screen for the specified final time tf . The computation time interval t is determined automatically by MATLAB. generates a plot of a unit impulse response and displays a response curve on the screen for the user specified time t where t = 0 : t : tf . Returns the output y, and the time array t used for the simulation. No plot is drawn. The array y is p q m where p is length(t), q is the number of outputs, and m is the number of inputs.
>> impulse(sys,tf)
>> impulse(sys,t)
>> [y,t]=impulse(sys,)
>>impulse(sys1, sys2,,t)
Plots the impulse response of multiple LTI systems on a single plot. The time vector t is optional. You can specify line color, line style and marker for each system.
The steady state response and the time to reach that steady state are automatically determined. The steady state response is indicated by horizontal dotted line. For more details in this topic: type doc impulse or help impulse at MATLAB prompt >> Impulse Input. The impulse response of a mechanical system can be observed when the system is subjected to a very large force for a very short time, for instance, when the mass of a spring-mass-dashpot system is hit by a hammer or a bullet. Mathematically, such an impulse input can be expressed by an impulse function. The impulse function is a mathematical function without any actual physical counterpart. However, as shown in Figure 4-12 (a), if the actual input lasts for a short time t but has a magnitude h , so that the area h t in a time plot is not negligible, it can be approximated by an impulse function. The impulse input is usually denoted by a vertical arrow, as shown in Figure 4-12 (b), to indicate that it has a very short duration and a very large height.
20/26
x
Area not negligible
t
t
(a)
t
0
(b)
Figure 4-12 Impulse inputs Example 4-7 Consider the previous Example 4-6 but with an impulse input of magnitude 10 N. MATLAB PROGRAM: >> >> >> >> >> >> >> >> >> m=0.1; b2=0.4; k1=6;k2=4; num1=[b2 k2] num2=[k2] den=[m*b2 m*k2 k1*b2+k2*b2 sys1=tf(num1,den) sys2=tf(num2,den) impulse(10*sys1,'r:',10*sys2,'b') grid gtext('x(t)');gtext('y(t)')
k1*k2]
21/26
Impulse Response 12
x(t)
10
y(t)
8
4 Amplitude
-2
-4
-6
-8
0.5
1.5
2.5
3.5
4.5
Time (sec)
Figure 4-13 Impulse response curves x ( t ) and y ( t ) Obtaining response to arbitrary input. The lsim function plots the response of the system to an arbitrary input. The basic syntax commands is summarized below Command (Basic Syntax) >> lsim(sys,u,t) Use produces a plot of the time response of the LTI model sys to the input time history t,u. The vector t specifies the time samples for the simulation and consists of regularly spaced time samples. t = 0 : t : tf The matrix u must have as many rows as time samples (length(t)) and as many columns as system inputs. Each row u(i,:) specifies the input value(s) at the time sample t(i).
For more details in this topic: type doc lsim or help lsim at MATLAB prompt >> Example 4-8 Consider the mass-spring-dashpot system mounted on a cart of Example 4-3 The TF of the system is
Y (s) ( bs + k ) = U ( s ) ( ms 2 + b s + k ) U (s)
where
Y (s)
is the output
b = 20 N-s/m and k = 100 N/m . Find the response y ( t ) for a ramp input with a slope of 2, ( r (t ) = 2t ).
22/26
MATLAB PROGRAM: >> >> >> >> >> >> m=10; b=20; k=100; num=[b k];den=[m b k]; sys=tf(num,den); t=[0:0.001:3]; u=2*t; lsim(sys,u,t);grid;gtext('x(t)');gtext('y(t)')
Linear Simulation Results 6
Amplitude
r(t)
1
y(t)
0
0.5
2.5
Example 4-9 Find the response y ( t ) of the previous Example 4-8 if the input is shown by the Figure below.
r (t )
1
t
Figure 4-15 Arbitrary input
1
MATLAB PROGRAM: >> >> >> >> >> >> >> m=10; b=20; k=100; num=[b k] den=[m b k] sys=tf(num,den) t=[0:0.001:5]; for k=1:length(t) if t(k) <= 1 r(k) =t(k); else r(k)=1; end
23/26
1.4
y(t)
1.2
r(t)
0.8
0.6
0.4
0.2
0.5
1.5
3.5
4.5
24/26
directly by solving the system of Equations (3) and (4) with the unknowns X ( s ) and
k2 X ( s ) + [ b2 s + k2 ]Y ( s ) = 0
(4) Method of Substitution: The above system can be solved by substituting of one of the unknowns from one equation into the other. For instance, from Eq. (4)
(3)
Y (s) =
Substitute Eq. (5) into Eq. (3) we get
k2 X (s) [b2 s + k2 ]
(5)
2 k2 ms + ( k1 + k2 ) X ( s ) [ b s + k ] X ( s ) = P(s ) 2 2 2
or
or
X (s) =
Substitute
P ( s ) ( b2 s + k2 )
X (s)
25/26
X ( s ) and
P(s ) a12 a22 0 P(s )a22 = X(s ) = a11 a12 a11a22 a12 a12 a21 a22 a11 P(s ) a 0 P(s )a21 = Y (s ) = 21 a11 a12 a11a22 a12 a12 a21 a22
or
( b2 s + k 2 ) X(s) a22 = = P(s ) a11a22 a12 a12 ms 2 + ( k1 + k2 ) ( b2 s + k2 ) k 2 Y (s) a21 k2 = = 2 P(s ) a11a22 a12 a12 ms + ( k1 + k2 ) ( b2 s + k2 ) k 2
Therefore it does not appear in the equation of motion.
26/26