Frequency Response (Matlab, example 2) ()

advertisement
ELEC356
Electronics II
Spring 2008
Frequency Response
Example 2. For the following circuit find:
a) the transfer function H(ω) = Vin(ω) / Iin(ω).
b) its poles and zeros.
c) using MATLAB plot its frequency response. First in V/A and then in dB
Assume: R1= 5 Ω, R2 = 3 Ω, C = 0.1 F, L = 2 H
Solution:
a) Note that: Vin = Zeq Iin ; h(t) = Vin(t) / Iin = Zeq , in the frequency domain we have
H(ω) =Vin(ω) / Iin(ω) = Zeq(ω)
Zeq= (R1 + ZC) ║ (R2 + ZL)
ZC = 1 / (jωC) = 1 / sC ;
ZL = jωL) = sL
Zeq(s) = H(s) = [R1 R2 + R2 /sC + R1 sL + L/C] / [R1 R2 + sL + 1/sC]
Substituting values we obtain:
H(s) = (5 s2 + 17.5 s + 15) / (s2 + 4s +5)
b) The zeros of the function is when (5 s2 + 17.5 s + 15) = 0;
The poles of the function is when (s2 + 4 s + 5) = 0 ;
z1 = – 2,
p1 = – 2 + j 1
z2 = –1.5
p2 = – 2 – j 1
c) The MATLAB code to plot the frequency response is:
% MATLAB code to plot the frequency response of example2.
% H(s) = Num/Den
% Num = 5 S^2 + 17.5 S + 15
% Den = S^2 + 4 S + 5
num = ([5 17.5 15]);
den = ([1 4 5]);
range=linspace(0.1,10,1000);
Hs=freqresp(num, den, range);
magH=abs(Hs);
phaseH=angle(Hs)*180/pi;
%
% PLOT OF THE MAGNITUDE OF H(W)
%
plot(range, magH)
xlabel('frequency w [rad/s]')
ylabel('mag H(jw) [V/A]')
title('Magnitude of H(s)')
text(6.5,3.9, 'H(s)=Num/Den')
text(6.5,3.8,'Num=5s^2+17.5s+15')
text(6.5,3.7,'Den=s^2+4s+5')
%
1
ELEC356
Electronics II
Spring 2008
% PLOT OF THE PHASE OF H(W)
%
figure
plot(range, phaseH)
xlabel('frequency w [rad/s]')
ylabel('phase H(jw) [degrees]')
title('Phase of H(s)')
%%% FREQUENCY RESPONBSE IN DECIBELES. SEMILOG PLOT
%
% MAGNITUDE OF H(W) IN DECIBELS
%
figure
rangelog=logspace(-2,2,100);
Hslog=freqresp(num, den, rangelog);
magHdb=20*log10(abs(Hslog));
plot(rangelog, magHdb)
xlabel('frequency w [rad/s]')
ylabel('mag H(jw) [dB]')
title('Magnitude of H(s) in dB')
text(70,11.8, 'H(s)=Num/Den')
text(70,11.6,'Num=5s^2+17.5s+15')
text(70,11.4,'Den=s^2+4s+5')
%%%
2
ELEC356
Electronics II
Spring 2008
Homework problem.
Given the following transfer function:
a) Find the poles and zeros of the function.
b) Using MATLAB plot the magnitude and phase of the function. Use log scale for the frequency axis. Plot
both, the linear magnitude and the magnitude in dB.
c) What type of filter is this function (lowpass of highpass) ? Explain.
G(s) = s3 / [ s3 +14.8 s2 + 38.1 s + 2554]
3
Download