![Page 1: Calculating Gain and Phase from Transfer Functions](https://reader030.vdocuments.site/reader030/viewer/2022012606/619ae967cda59d547526952a/html5/thumbnails/1.jpg)
1
Calculating Gain and Phase from Transfer Functions
MECH 3140Lecture #
![Page 2: Calculating Gain and Phase from Transfer Functions](https://reader030.vdocuments.site/reader030/viewer/2022012606/619ae967cda59d547526952a/html5/thumbnails/2.jpg)
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
![Page 3: Calculating Gain and Phase from Transfer Functions](https://reader030.vdocuments.site/reader030/viewer/2022012606/619ae967cda59d547526952a/html5/thumbnails/3.jpg)
Gain and Phase
β’ The gain and phase are found by calculating the gain and angle of the transfer function evaluates at jΟ
πΊπΊ ππ = π»π»(ππππ) =πππ’π’ππ(ππππ)ππππππ(ππππ)
β ππ = β π»π» ππππ = β πππ’π’ππ ππππ β β ππππππ ππππ
3
![Page 4: Calculating Gain and Phase from Transfer Functions](https://reader030.vdocuments.site/reader030/viewer/2022012606/619ae967cda59d547526952a/html5/thumbnails/4.jpg)
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
![Page 5: Calculating Gain and Phase from Transfer Functions](https://reader030.vdocuments.site/reader030/viewer/2022012606/619ae967cda59d547526952a/html5/thumbnails/5.jpg)
Example #1 (solving the Diff Eq)
Solving for H (which is the output):π»π» =
ππππ + 1ππππ + 1
πΊπΊ =π»π»ππ
=ππ2 + 12
ππ2 + 12= 1
5
![Page 6: Calculating Gain and Phase from Transfer Functions](https://reader030.vdocuments.site/reader030/viewer/2022012606/619ae967cda59d547526952a/html5/thumbnails/6.jpg)
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
![Page 7: Calculating Gain and Phase from Transfer Functions](https://reader030.vdocuments.site/reader030/viewer/2022012606/619ae967cda59d547526952a/html5/thumbnails/7.jpg)
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
![Page 8: Calculating Gain and Phase from Transfer Functions](https://reader030.vdocuments.site/reader030/viewer/2022012606/619ae967cda59d547526952a/html5/thumbnails/8.jpg)
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
![Page 9: Calculating Gain and Phase from Transfer Functions](https://reader030.vdocuments.site/reader030/viewer/2022012606/619ae967cda59d547526952a/html5/thumbnails/9.jpg)
Example #2 (solving the Diff Eq)
Solving for H (which is the output):π»π» =
ππβππ2 + 25
πΊπΊ =π»π»ππ
=1
25 β ππ2
9
![Page 10: Calculating Gain and Phase from Transfer Functions](https://reader030.vdocuments.site/reader030/viewer/2022012606/619ae967cda59d547526952a/html5/thumbnails/10.jpg)
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
![Page 11: Calculating Gain and Phase from Transfer Functions](https://reader030.vdocuments.site/reader030/viewer/2022012606/619ae967cda59d547526952a/html5/thumbnails/11.jpg)
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
![Page 12: Calculating Gain and Phase from Transfer Functions](https://reader030.vdocuments.site/reader030/viewer/2022012606/619ae967cda59d547526952a/html5/thumbnails/12.jpg)
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).
![Page 13: Calculating Gain and Phase from Transfer Functions](https://reader030.vdocuments.site/reader030/viewer/2022012606/619ae967cda59d547526952a/html5/thumbnails/13.jpg)
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
![Page 14: Calculating Gain and Phase from Transfer Functions](https://reader030.vdocuments.site/reader030/viewer/2022012606/619ae967cda59d547526952a/html5/thumbnails/14.jpg)
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)
![Page 15: Calculating Gain and Phase from Transfer Functions](https://reader030.vdocuments.site/reader030/viewer/2022012606/619ae967cda59d547526952a/html5/thumbnails/15.jpg)
Calculating Gain and Phase in Matlab
15
β’ Note the spike at Ο=5 rad/s
![Page 16: Calculating Gain and Phase from Transfer Functions](https://reader030.vdocuments.site/reader030/viewer/2022012606/619ae967cda59d547526952a/html5/thumbnails/16.jpg)
Example #3
16
β’ PI Cruise Control from a few lectures ago:πποΏ½ΜοΏ½π + ππππ = π π
πΎπΎππππ + πΎπΎπΌπΌ οΏ½πππππ‘π‘ = π π
β Taking the laplace of each equation (with IC=0 and e=r-v):
πππ π ππ(π π ) + ππππ(π π ) = π π (π π )
πΎπΎπΎπΎ π π π π β ππ π π + πΎπΎπΌπΌπ π
(π π π π β ππ π π ) = π π (π π )
![Page 17: Calculating Gain and Phase from Transfer Functions](https://reader030.vdocuments.site/reader030/viewer/2022012606/619ae967cda59d547526952a/html5/thumbnails/17.jpg)
Example #3
17
β Substituting in F(s) and collecting terms
ππ π π πππ π + ππ + πΎπΎππ +πΎπΎπΌπΌπ π
= π π π π πΎπΎππ +πΎπΎπΌπΌπ π
β Then solving for the transfer function:
ππ π π π π (π π )
=πΎπΎππ + πΎπΎπΌπΌ
π π πππ π + ππ + πΎπΎππ + πΎπΎπΌπΌ
π π
=πΎπΎπππ π + πΎπΎπΌπΌ
πππ π 2 + (ππ + πΎπΎππ)π π + πΎπΎπΌπΌ
![Page 18: Calculating Gain and Phase from Transfer Functions](https://reader030.vdocuments.site/reader030/viewer/2022012606/619ae967cda59d547526952a/html5/thumbnails/18.jpg)
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)
![Page 19: Calculating Gain and Phase from Transfer Functions](https://reader030.vdocuments.site/reader030/viewer/2022012606/619ae967cda59d547526952a/html5/thumbnails/19.jpg)
Example #3
19
Now to find the gain and phase:
β πΊπΊ ππ = πΎπΎππππππ+πΎπΎπΌπΌππ ππππ 2+(πΎπΎππ+ππ) ππππ +πΎπΎπΌπΌ
=(πΎπΎππππ)2+(πΎπΎπΌπΌ)2
(πΎπΎππππ+ππππ)2+(πΎπΎπΌπΌβππππ2)2
β β ππ = π‘π‘π‘π‘ππβ1 πΎπΎπππππΎπΎπΌπΌ
β π‘π‘π‘π‘ππβ1 πΎπΎππππ+πππππΎπΎπΌπΌβππππ2
![Page 20: Calculating Gain and Phase from Transfer Functions](https://reader030.vdocuments.site/reader030/viewer/2022012606/619ae967cda59d547526952a/html5/thumbnails/20.jpg)
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
![Page 21: Calculating Gain and Phase from Transfer Functions](https://reader030.vdocuments.site/reader030/viewer/2022012606/619ae967cda59d547526952a/html5/thumbnails/21.jpg)
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)