calculating gain and phase from transfer functions
TRANSCRIPT
1
Calculating Gain and Phase from Transfer Functions
MECH 3140Lecture #
Transfer Functions
โข A differential equation ๐๐ ๐ฅ๐ฅ, ๏ฟฝฬ๏ฟฝ๐ฅ, ๏ฟฝฬ๏ฟฝ๐ฅ, โฆ = ๐ข๐ข(๐ก๐ก), has ๐ข๐ข ๐ก๐ก as the input to the system with the output ๐ฅ๐ฅ
โข Recall that transfer functions are simply the Laplace Transform representation of a differential equation from input to output:
๐ป๐ป(๐ ๐ ) =๐๐(๐ ๐ )๐ข๐ข(๐ ๐ )
โข Therefore it can be used to find the Gain and Phase between the input and output
2
Gain and Phase
โข The gain and phase are found by calculating the gain and angle of the transfer function evaluates at jฯ
๐บ๐บ ๐๐ = ๐ป๐ป(๐๐๐๐) =๐๐๐ข๐ข๐๐(๐๐๐๐)๐๐๐๐๐๐(๐๐๐๐)
โ ๐๐ = โ ๐ป๐ป ๐๐๐๐ = โ ๐๐๐ข๐ข๐๐ ๐๐๐๐ โ โ ๐๐๐๐๐๐ ๐๐๐๐
3
Example #1 (solving the Diff Eq)
Fall 2019 Exam #1, Bonus Problem:๏ฟฝฬ๏ฟฝ๐ฅ + ๐ฅ๐ฅ = ฬ๐๐ + ๐๐ ๐๐ ๐๐ = sin(๐๐๐ก๐ก)
Recall we can represent a sinusoid in the following format:
๐๐ = ๐ผ๐ผ๐๐๏ฟฝ ๏ฟฝ1๐๐๐๐๐๐๐๐
๐ฅ๐ฅ = ๐ผ๐ผ๐๐๏ฟฝ ๏ฟฝ๐ป๐ป๐๐๐๐๐๐๐๐
Then taking the derivatives:๏ฟฝฬ๏ฟฝ๐ฅ = ๐ผ๐ผ๐๐๏ฟฝ ๏ฟฝ๐ป๐ป๐๐๐๐๐๐๐๐๐๐๐๐ฬ๐๐ = ๐ผ๐ผ๐๐๏ฟฝ ๏ฟฝ1๐๐๐๐๐๐๐๐๐๐๐๐
๐ผ๐ผ๐๐๏ฟฝ ๏ฟฝ๐ป๐ป๐๐๐๐๐๐๐๐๐๐ + ๐ป๐ป๐๐๐๐๐๐๐๐ = 1๐๐๐๐๐๐๐๐ + 1๐๐๐๐๐๐๐๐๐๐๐๐
4
Example #1 (solving the Diff Eq)
Solving for H (which is the output):๐ป๐ป =
๐๐๐๐ + 1๐๐๐๐ + 1
๐บ๐บ =๐ป๐ป๐๐
=๐๐2 + 12
๐๐2 + 12= 1
5
Example #1 (using Transfer Function)
Fall 2019 Exam #1, Bonus Problem:๏ฟฝฬ๏ฟฝ๐ฅ + ๐ฅ๐ฅ = ฬ๐๐ + ๐๐ ๐๐ ๐๐ = sin(๐๐๐ก๐ก)
Take the Laplace of the entire equation and setting initial conditions to zero (since we are solving for the transfer function):
๐ ๐ ๐๐ ๐ ๐ + ๐๐ ๐ ๐ = ๐ ๐ ๐ ๐ ๐ ๐ + ๐ ๐ (๐ ๐ )
๐๐ ๐ ๐ ๐ ๐ + 1 = ๐ ๐ (๐ ๐ )(๐ ๐ + 1)
๐๐(๐ ๐ )๐ ๐ (๐ ๐ )
=๐ ๐ + 1๐ ๐ + 1
6
Example #1 (using Transfer Function)
Now, to find the gain simply evaluate the transfer function at jฯ
๐๐(๐ ๐ )๐ ๐ (๐ ๐ )
=๐ ๐ + 1๐ ๐ + 1
๐บ๐บ =๐๐๐๐ + 1๐๐๐๐ + 1
=๐๐2 + 12
๐๐2 + 12= 1
7
Example #2 (solving the Diff Eq)
Spring 2020 Exam #1, Bonus Problem:๏ฟฝฬ๏ฟฝ๐ฅ + 25๐ฅ๐ฅ = ๐ข๐ข(t)
Recall we can represent a sinusoid in the following format:
๐ข๐ข = ๐ผ๐ผ๐๐๏ฟฝ ๏ฟฝ๐๐๐๐๐๐๐๐๐๐
๐ฅ๐ฅ = ๐ผ๐ผ๐๐๏ฟฝ ๏ฟฝ๐ป๐ป๐๐๐๐๐๐๐๐
Then taking the derivatives:๏ฟฝฬ๏ฟฝ๐ฅ = ๐ผ๐ผ๐๐๏ฟฝ ๏ฟฝ๐ป๐ป๐๐๐๐๐๐๐๐๐๐๐๐
๏ฟฝฬ๏ฟฝ๐ฅ = ๐ผ๐ผ๐๐ ๏ฟฝ ๏ฟฝ๐ป๐ป(๐๐๐๐)2๐๐๐๐๐๐๐๐ = ๐ผ๐ผ๐๐๏ฟฝ ๏ฟฝโ๐ป๐ป๐๐2๐๐๐๐๐๐๐๐
๐ผ๐ผ๐๐๏ฟฝ ๏ฟฝโ๐ป๐ป๐๐2๐๐๐๐๐๐๐๐ + 25๐ป๐ป๐๐๐๐๐๐๐๐ = ๐๐๐๐๐๐๐๐๐๐8
Example #2 (solving the Diff Eq)
Solving for H (which is the output):๐ป๐ป =
๐๐โ๐๐2 + 25
๐บ๐บ =๐ป๐ป๐๐
=1
25 โ ๐๐2
9
Example #2 (using Transfer Function)
Spring 2020 Exam #1, Bonus Problem:๏ฟฝฬ๏ฟฝ๐ฅ + 25๐ฅ๐ฅ = ๐ข๐ข(t)
Take the Laplace of the entire equation and setting initial conditions to zero (since we are solving for the transfer function):
๐ ๐ 2๐๐ ๐ ๐ + 25๐๐ ๐ ๐ = ๐๐(๐ ๐ )
๐๐ ๐ ๐ ๐ ๐ 2 + 25 = ๐๐(๐ ๐ )
๐๐(๐ ๐ )๐๐(๐ ๐ )
=1
๐ ๐ 2 + 25
10
Example #2 (using Transfer Function)
Now, to find the gain simply evaluate the transfer function at jฯ
๐๐(๐ ๐ )๐๐(๐ ๐ )
=1
๐ ๐ 2 + 25
๐บ๐บ =1
(๐๐๐๐)2+25=
125 โ๐๐2
11
Calculating Gain and Phase in Matlab
12
โข Matlab uses transfer functions to calculate gain and phase and generate bode plots
โข Recall that there are 2 ways to plot data logarithmicallyโ 1) Plot on a log scaleโ 2) Take the log of the data & plot on normal scaleโ Matlab does both (just to be annoying or to
ensure you can do both โ actually its just the standard of how bode plots are shown).
Calculating Gain and Phase in Matlab
13
โข Matlab plots the Gain in decibels (db):1 ๐๐๐๐ = 20๐๐๐๐๐๐10(๐บ๐บ)
โข Note the following about db:G=0 db (Gain=1, output=input)G>0 db (Gain>1, output>input)G<0 db (Gain<1, output<input
Calculating Gain and Phase in Matlab
14
โข Matlab code:>> num=1;>> den=[1 0 25]; % ๐ ๐ 2 + 0๐ ๐ + 25>> sys=tf(num,den)>>bode(sys)
โข If you want the actual gain you can do:>>[gain, phase, freq]=bode(sys)
Calculating Gain and Phase in Matlab
15
โข Note the spike at ฯ=5 rad/s
Example #3
16
โข PI Cruise Control from a few lectures ago:๐๐๏ฟฝฬ๏ฟฝ๐ + ๐๐๐๐ = ๐ ๐
๐พ๐พ๐๐๐๐ + ๐พ๐พ๐ผ๐ผ ๏ฟฝ๐๐๐๐๐ก๐ก = ๐ ๐
โ Taking the laplace of each equation (with IC=0 and e=r-v):
๐๐๐ ๐ ๐๐(๐ ๐ ) + ๐๐๐๐(๐ ๐ ) = ๐ ๐ (๐ ๐ )
๐พ๐พ๐พ๐พ ๐ ๐ ๐ ๐ โ ๐๐ ๐ ๐ + ๐พ๐พ๐ผ๐ผ๐ ๐
(๐ ๐ ๐ ๐ โ ๐๐ ๐ ๐ ) = ๐ ๐ (๐ ๐ )
Example #3
17
โ Substituting in F(s) and collecting terms
๐๐ ๐ ๐ ๐๐๐ ๐ + ๐๐ + ๐พ๐พ๐๐ +๐พ๐พ๐ผ๐ผ๐ ๐
= ๐ ๐ ๐ ๐ ๐พ๐พ๐๐ +๐พ๐พ๐ผ๐ผ๐ ๐
โ Then solving for the transfer function:
๐๐ ๐ ๐ ๐ ๐ (๐ ๐ )
=๐พ๐พ๐๐ + ๐พ๐พ๐ผ๐ผ
๐ ๐ ๐๐๐ ๐ + ๐๐ + ๐พ๐พ๐๐ + ๐พ๐พ๐ผ๐ผ
๐ ๐
=๐พ๐พ๐๐๐ ๐ + ๐พ๐พ๐ผ๐ผ
๐๐๐ ๐ 2 + (๐๐ + ๐พ๐พ๐๐)๐ ๐ + ๐พ๐พ๐ผ๐ผ
Example #3
18
โข This is called the closed loop transfer functionโ It is from the reference input to the velocity
outputโ Notice the DC Gain is one (which means for a
constant reference, the steady state velocity will equal the reference
โ Notice the PI controller adds a โzeroโ (root in the numerator) and a โpoleโ
โข So the total order is 2nd order (2 poles or 2nd order denominator)
Example #3
19
Now to find the gain and phase:
โ ๐บ๐บ ๐๐ = ๐พ๐พ๐๐๐๐๐๐+๐พ๐พ๐ผ๐ผ๐๐ ๐๐๐๐ 2+(๐พ๐พ๐๐+๐๐) ๐๐๐๐ +๐พ๐พ๐ผ๐ผ
=(๐พ๐พ๐๐๐๐)2+(๐พ๐พ๐ผ๐ผ)2
(๐พ๐พ๐๐๐๐+๐๐๐๐)2+(๐พ๐พ๐ผ๐ผโ๐๐๐๐2)2
โ โ ๐๐ = ๐ก๐ก๐ก๐ก๐๐โ1 ๐พ๐พ๐๐๐๐๐พ๐พ๐ผ๐ผ
โ ๐ก๐ก๐ก๐ก๐๐โ1 ๐พ๐พ๐๐๐๐+๐๐๐๐๐พ๐พ๐ผ๐ผโ๐๐๐๐2
Example #3 (Bode Plot)
20
m=1800 kg (me in a mustang)b=10 Ns/m (made up)
Kp=1,589 Ns/mKi=710 N/m
Example #3
21
Lets assume R=10sin(1t).What would the carโs velocity be?
โ ๐บ๐บ 1 = (1589)2+(710)2
(1599)2+(710โ1800)2= 0.899
โ โ 1 = ๐ก๐ก๐ก๐ก๐๐โ1 1589710
โ ๐ก๐ก๐ก๐ก๐๐โ1 1599710โ1800
= โ58 ๐๐๐๐๐๐
๐๐ ๐ก๐ก = 8.99sin(1๐ก๐ก โ 1.019)