Transfer Functions
Transfer Functions
In [ ]:
% Matlab setup
clear all
cd matlab
pwd
Transfer Functions
A Couple of Examples
Vout (s)
Gv (s) =
Vin (s)
Similarly, the ratio of the output current I out (s) to the input current I in (s) under zero initial conditions, is
called the cuurent transfer function denoted Gi (s):
I out (s)
Gi (s) =
I in (s)
In practice, the current transfer function is rarely used, so we will use the voltage transfer function denoted:
Vout (s)
G(s) =
Vin (s)
Example 6
Derive an expression for the transfer function G(s) for the circuit below. In this circuit Rg represents the
internal resistance of the applied (voltage) source vs , and RL represents the resistance of the load that
consists of RL , L and C .
http://localhost:8890/nbconvert/html/dev/EG-247-Resources/week3/transfer_functions.ipynb?download=false 1/9
04/02/2018 transfer_functions
Sketch of Solution
Replace vs (t), Rg , RL , L and C by their transformed (complex frequency) equivalents: Vs (s) , Rg , RL
, sL and 1/(sC)
Use the Voltage Divider Rule to determine Vout (s) as a function of Vs (s)
Form G(s) by writing down the ratio Vout (s)/Vs (s)
Worked solution.
Pencast: ex6.pdf (worked%20examples/ex6.pdf) - open in Adobe Acrobat Reader.
Answer
Vout (s) RL + sL + 1/sC
G(s) = = .
Vs (s) Rg + RL + sL + 1/sC
http://localhost:8890/nbconvert/html/dev/EG-247-Resources/week3/transfer_functions.ipynb?download=false 2/9
04/02/2018 transfer_functions
Example 7
Compute the transfer function for the op-amp circuit shown below in terms of the circuit constants R1 , R2 ,
R3 , C1 and C2 . Then replace the complex variable s with jω , and the circuit constants with their numerical
values and plot the magnitude |G(s)| = |Vout (s)/Vin (s)| versus radian frequency ω .
http://localhost:8890/nbconvert/html/dev/EG-247-Resources/week3/transfer_functions.ipynb?download=false 3/9
04/02/2018 transfer_functions
Sketch of Solution
Replace the components and voltages in the circuit diagram with their complex frequency
equivalents
Use nodal analysis to determine the voltages at the nodes either side of the 50K resistor R3
Note that the voltage at the input to the op-amp is a virtual ground
Solve for Vout (s) as a function of Vin (s)
Form the reciprocal G(s) = Vout (s)/Vin (s)
Use MATLAB to calculate the component values, then replace s by jω .
Plot ∣G(jω)∣ on log-linear "paper"
Worked solution.
Pencast: ex7.pdf (worked%20examples/ex7.pdf) - open in Adobe Acrobat Reader.
Answer
Vout (s) −1
G(s) = = .
Vin (s) R1 ((1/R1 + 1/R2 + 1/R3 + sC1 ) (sC2 R3 ) + 1/R2 )
Week 3: Solution 7
In [1]:
syms s;
In [2]:
R1 = 200*10^3;
R2 = 40*10^3;
R3 = 50*10^3;
C1 = 25*10^(-9);
C2 = 10*10^(-9);
In [3]:
ans =
100*s*((7555786372591433*s)/302231454903657293676544 + 1/20000) + 5
http://localhost:8890/nbconvert/html/dev/EG-247-Resources/week3/transfer_functions.ipynb?download=false 4/9
04/02/2018 transfer_functions
In [4]:
format long
denG = sym2poly(ans)
denG =
In [26]:
numG = -1;
Plot
In [5]:
a = denG(1);
b = denG(2);
In [7]:
w = 1:10:10000;
−1
G(jω) =
2
aω − jbω + 5
In [10]:
http://localhost:8890/nbconvert/html/dev/EG-247-Resources/week3/transfer_functions.ipynb?download=false 5/9
04/02/2018 transfer_functions
In [11]:
semilogx(w, abs(Gs))
xlabel('Radian frequency w (rad/s')
ylabel('|Vout/Vin|')
title('Magnitude Vout/Vin vs. Radian Frequency')
grid
The Simulink transfer function (Transfer Fcn) block shown above implements a transfer function
representing a general input output function
N (s)
G(s) =
D(s)
that it is not specific nor restricted to circuit analysis. It can, however be used in modelling and simulation
studies.
http://localhost:8890/nbconvert/html/dev/EG-247-Resources/week3/transfer_functions.ipynb?download=false 6/9
04/02/2018 transfer_functions
Example
Recast Example 7 as a MATLAB problem using the LTI Transfer Function block.
MATLAB Solution
Vout −1
G(s) = =
Vin R1 [(1/R1 + 1/R2 + 1/R3 + sC1 )(sR3 C2 ) + 1/R2 ]
Vout −1
G(s) = =
2
Vin s + 3s + 1
We can find the step response by letting vin (t) = u0 (t) so that Vin (s) = 1/s then
−1 1
Vout (s) = .
2
s + 3s + 1 s
We can solve this by partial fraction expansion and inverse Laplace transform as is done in the text book
with the help of Matlab's residue function.
Here, however we'll use the LTI block that was introduced in the lecture.
In [18]:
G = tf([-1],[1 3 1])
G =
In [ ]:
step(G)
Simples!
Simulink model
http://localhost:8890/nbconvert/html/dev/EG-247-Resources/week3/transfer_functions.ipynb?download=false 7/9
04/02/2018 transfer_functions
In [ ]:
open example_8
Result
http://localhost:8890/nbconvert/html/dev/EG-247-Resources/week3/transfer_functions.ipynb?download=false 8/9
04/02/2018 transfer_functions
In [17]:
bode(G)
http://localhost:8890/nbconvert/html/dev/EG-247-Resources/week3/transfer_functions.ipynb?download=false 9/9