Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
5 views

Transfer Functions

Uploaded by

joker prince
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Transfer Functions

Uploaded by

joker prince
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

04/02/2018 transfer_functions

In [ ]:

% Matlab setup
clear all
cd matlab
pwd

Transfer Functions

Second Hour's Agenda


Transfer Functions

A Couple of Examples

Circuit Analysis Using MATLAB LTI Transfer Function Block

Circuit Simulation Using Simulink Transfer Function Block

Transfer Functions for Circuits


When doing circuit analysis with components defined in the complex frequency domain, the ratio of the
output voltage Vout (s) ro the input voltage Vin (s) under zero initial conditions is of great interest. This ratio is
known as the voltage transfer function denoted Gv (s) :

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 )

The Matlab Bit


See attached script: solution7.m (matlab/solution7.m).

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]:

den = R1*((1/R1+ 1/R2 + 1/R3 + s*C1)*(s*R3*C2) + 1/R2);


simplify(den)

ans =

100*s*((7555786372591433*s)/302231454903657293676544 + 1/20000) + 5

Result is: 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

Simplify coefficients of s in denominator

In [4]:

format long
denG = sym2poly(ans)

denG =

0.000002500000000 0.005000000000000 5.000000000000000

In [26]:

numG = -1;

Plot

For convenience, define coefficients a and b:

In [5]:

a = denG(1);
b = denG(2);

In [7]:

w = 1:10:10000;

−1
G(jω) =
2
aω − jbω + 5

In [10]:

Gs = -1./(a*w.^2 - j.*b.*w + denG(3));

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

Using Transfer Functions in Matlab for System Analysis


Please use the file tf_matlab.m (matlab/tf_matlab.m) to explore the Transfer Function features provide by
Matlab. Use the publish option to generate a nicely formatted document.

Using Transfer Functions in Simulink for System Simulation

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.

For simplicity use parameters R1 = R2 = R3 = 1 Ω , and C1 = C2 = 1 F .

Calculate the step response using the LTI functions.

Verify the result with Simulink.

The Matlab solution: example8.m (matlab/example8.m)

MATLAB Solution

From a previous analysis the transfer function is:

Vout −1
G(s) = =
Vin R1 [(1/R1 + 1/R2 + 1/R3 + sC1 )(sR3 C2 ) + 1/R2 ]

so substituting the component values we get:

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.

Define the circuit as a transfer function

In [18]:

G = tf([-1],[1 3 1])

G =

step response is then:

In [ ]:

step(G)

Simples!

Simulink model

See example_8.slx (matlab/example_8.slx)

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

Let's go a bit further by finding the frequency response:

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

You might also like