+ All Categories
Home > Documents > Calculating Gain and Phase from Transfer Functions

Calculating Gain and Phase from Transfer Functions

Date post: 22-Nov-2021
Category:
Upload: others
View: 5 times
Download: 0 times
Share this document with a friend
21
1 Calculating Gain and Phase from Transfer Functions MECH 3140 Lecture #
Transcript
Page 1: Calculating Gain and Phase from Transfer Functions

1

Calculating Gain and Phase from Transfer Functions

MECH 3140Lecture #

Page 2: Calculating Gain and Phase from Transfer Functions

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

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

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

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

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

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

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

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

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

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

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

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

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

Calculating Gain and Phase in Matlab

15

β€’ Note the spike at Ο‰=5 rad/s

Page 16: Calculating Gain and Phase from Transfer Functions

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

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

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

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

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

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)


Recommended