
























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An example of determining the transfer function for a given circuit and plotting its magnitude and phase using matlab. It also discusses the concept of bode plots and how to sketch them manually. The script for determining the plot range based on the roots of the transfer function.
Typology: Study notes
1 / 32
This page cannot be seen from the preview
Don't miss anything!

























Node Voltage Example ¾^
Perform phasor analysis to determine
v o
( t ) for
ω
=2. Since the
frequency of the source is not specified, leave impedances interms of
= s
¾^
Show that ¾^
Show
v^0
( t ) = .33cos(
t -9.
° ) V , when
ω
v ( s
t) = cos(
ω t
) V
2 Ω
4 Ω 0.5 F
2 H
(^
)^
⎞⎟⎟⎠
⎛^ ⎜⎜⎝
⎞⎟ ⎠
⎛⎜ ⎝
−
−°
∠ + − ∠ = + +
=^
−
2
1
2 (^222)
2
(^33)
tan 90
9 ) (^3) ( ˆ ˆ 3 3 ˆ ˆ
ω^ ω
ω ω ω
s s
s o^
V V
s s
s
V V
Transfer Functions^ ¾
Definition:
A transfer function (TF) is a complex-valued
function of
ω
, such that the TF magnitude indicates the scaling
between the input and output magnitudes, and the TF phaseindicates the phase shifting between the input and outputphases. The transfer function indicates this relationship for allinput frequencies. ¾^
To find a transfer function, convert to impedance circuit, butleave the impedance values as functions of
j ω
= s.
Then solve for
the ratio of the phasor output divided by the phasor input.
Transfer Function Example Determine the transfer function for the circuit below, where the inputis^
v ( i
t ) and the output is
io
( t ).
Show transfer function is given by:
v ( ti
R ) 1
R^2
i C ( t )o ⎞⎟ ⎟⎠
⎛^ ⎜⎜⎝
⎞⎟⎟⎠
=
2 1
2 1
2 1
0
1
ˆ ˆ )( ˆ
R CR
R R s
R CR
I V s H
i
The following Matlab commands can be used to plot the results of thelast TF. Let R
= 50kf
= 10ki
=1.59kh
μF
Rf = 50e3; Ri = 10e3; Rh=1.59e3; C = 1e-6; f = [0:500]; % generate x-axis points s = j2pif; h = (1+Rf/Ri)s ./ (s + (1/(Rh*C)));
% Evaluate TF at every point
figure(1) % Plot Magnitude plot(f,abs(h)) xlabel('Hertz') ylabel('Magnitude') figure(2) % Plot Phase in Degrees plot(f,phase(h)*180/pi) xlabel('Hertz') ylabel('Degrees')
A decibel is a logarithmic measure of gain (or attenuation). A powergain between the designated system input and output is denoted inDecibels (or dB) as: ¾^
Express power in terms of voltage over a load to get another version ofthe dB formula:
⎞ ⎟ ⎟ ⎠
⎛ ⎜⎜ ⎝
=
out^ in
dB
P P
G
10 log
⎞ ⎟⎟ ⎠
⎛ ⎜⎜ ⎝
⎞ ⎟⎟ ⎠
⎛ ⎜⎜ ⎝
⎞ ⎟+⎟ ⎠
⎛ ⎜⎜ ⎝
⎞ ⎟⎟ ⎠
⎛ ⎜⎜ ⎝
=
⎞⎟⎟ ⎠
⎛⎜⎜ ⎝
⎞ ⎟⎟⎠
⎛⎞ ⎜⎟⎜⎟⎝⎠
⎛ ⎜⎜⎝
⎞ ⎟=⎟⎠
⎛ ⎜⎜⎝
=
in out
out in
dB
in out
out in
in in
out
out
dB
R R
V V
G
R R
V V
R V
R
V
G
10
10
2 2
10
2 2
10
log 10
log 20
log 10
/ /
log 10
If input and output impedances are considered equal (
R in
R out
) the
formula reduces to: Gain is always positive (between 0 and
). Describe the gain in dB
when the system is attenuating. Describe the gain in dB when the gainis unity.
out^ in
dB^
10
Before building our understanding on how to manipulate a polynomialfor convenient plotting, consider using Matlab to generate the plot. ¾^
Matlab Function behaves like a subroutine in a main program. Specifyinput and output arguments for your function (subroutine). The inputand output arguments are all the main program sees from the Matlabcommand line. The help files are the first set of comments and mustprovide all user needs to know in order to use it properly. ¾^
Example: Create a Matlab function that evaluates a TF based on itspolynomial coefficients. Generate a script that calls this function toshow how it works.
% Create s vector for evaluating TF
% Loop to sum up every term in numerator sumn = zeros(size(s)); % Initialize accumulation variable for k=1:num_order+
sumn = sumn + ns(k)*s.^(num_order-k+1); end % Loop to sum up every term in numerator sumd = zeros(size(s)); % Initialize accumulation variable for k=1:den_order+
sumd = sumd + ds(k)*s.^(den_order-k+1); end % Initialize output array to NaN (not a number) for cases where %^
the denominator is zeros (a pole) p = NaN*ones(size(s)); % Fill output vector with actual values where denominator is not 0 notzero = find(sumd ~= 0); % Get indices of vector where denominator is not zero p(notzero) = sumn(notzero) ./ sumd(notzero);
The following script will create the input variables for the function and plot theoutput. % This scripts demonstrates the TFEVAL function by evaluating %^
a transfer function at many points and plotting the result %^
on both a linear and log scale % generate 1000 points equally spaced on a Log Scale from 20 to 20kHz f = logspace(log10(20),log10(20000),1000); %^
3*s
% H(s) = -------------------------------- %^
s^2 + 1.81k*s + 900M
nu = [3 0];
% Numerator polynomial
de = [1 1.81e3 900e6]; % Denominator polynomial tf = tfeval(nu, de, f);
% Evaluate Transfer function
Linear Scales^0
0.^
1
1.^
2
2.5^4 x 10
x 101.8 1.6 1.4 1.2 (^1) 0.8 0.6 0.4 0.2 0
-^
Transfer Function Example - Linear
Hertz
TF magnitude
0
0.^
1
1.^
2
2.5^4 x 10
100 80 60 40 20 0 -20 -40 -60 -80 -
Transfer Function Example - Linear Scale
Hertz
TF phase (degrees)