Frequency Response (Report)
Frequency Response (Report)
Assignment 5
(Frequency Response)
Submitted to
Dr. Yasser Anis
Eng. Mohamed Wael
Prepared by B.N
Mahmoud Ahmed El-Sayed Kassab 28
June 7, 2021
Contents
a)Analytical expressions for the magnitude and phase response for G(s): .................................................. 3
b) Magnitude and phase plots (Bode plots) using MATLAB: ........................................................................ 4
c) Sketch asymptotic bode plot..................................................................................................................... 5
1.Bode asymptotic magnitude plot: ......................................................................................................... 6
2.Bode asymptotic phase plot: ................................................................................................................. 8
d) Comparison ............................................................................................................................................. 10
i. Magnitude response ................................................................................................................... 10
ii. Phase angle response.................................................................................................................. 10
Discussion............................................................................................................................................ 10
e) Stability check using Nyquist .................................................................................................................. 11
f)range of K for stability using Nyquist criterion ......................................................................................... 12
g)getting gain and phase margin using Asymptotic bode plot ................................................................... 13
h) Bode plots and Nyquist plots gain and phase margins .......................................................................... 16
Conclusion ................................................................................................................................................... 19
For a = 3 K1 = 6
𝐾(𝑠+𝑎+1) 6(𝑠+4)
.𝐺(𝑠) = =
𝑠(𝑠+𝑎)(𝑠+𝑎+2)(𝑠+𝑎+3) 𝑠(𝑠+3)(𝑠+5)(𝑠+6)
Matlab code
w=[.1:.1:1000];
m=(6.*((-10.*w.^4-162.*w.^2)+(w.^5-7.*w.^3-360.*w).*j))./(w.^8+70.*w.^6+1449.*w.^4+8100.*w.^2);
M=20.*log10(m);
semilogx(w,M,'k' , 'LineWidth', 2);
ylim([-140 20])
xlabel('Frequency (rad/sec)');
ylabel('20logM (dB)');
title('Magnitude vs Frequency');
grid on
𝐼𝑚𝑔 𝑝𝑎𝑟𝑡 (𝑤 5 −7𝑤 3 −360𝑤)
.𝑝ℎ𝑎𝑠𝑒 = 𝜑 = −𝑡𝑎𝑛−1 ( ) = −180° + 𝑡𝑎𝑛−1 [ (−10𝑤 4−162𝑤 2) ]
𝑅𝑒𝑎𝑙 𝑝𝑎𝑟𝑡
Matlab code
w=[.1:.1:1000];
ph=atan((w.^5-7.*w.^3-360.*w)./(-10.*w.^4-162.*w.^2));
phase=-180+((180/pi).*ph);
semilogx(w,phase,'k' , 'LineWidth', 2);
ylim([-272 -87])
xlabel('Frequency (rad/sec)');
ylabel('Phase (degree)');
title('Phase vs Frequency');
grid on
Discussion
1-The values from the analytical expressions and the Bode plots are almost identical.
2-there is difference between the asymptotic hand sketch plots and Bode plots values, however
its small difference so it is acceptable and this difference is due to the approximation done in
asymptotic plots.
e) Stability check using Nyquist
Matlab code
G=zpk([-4],[0,-3,-5,-6],[6]);
sisotool(G)
the frequency at which the Nyquist crosses the real axis when the imaginary part =0
nyquist (G)
2- k=10k=10*6=60
Matlab code
G=zpk([-4],[0,-3,-5,-6],[60]);
sisotool(G)
nyquist (G)
3- k=100k=100*6=600
Matlab code
G=zpk([-4],[0,-3,-5,-6],[600]);
sisotool(G)
nyquist (G)
Conclusion
#It is observed that the values of the gain and phase margins from the Bode plots and Nyquist
plots are identical regardless of the value of the gain K. However, the values of gain and phase
margins from the asymptotic plots are close to Bode plots and Nyquist plots but have slight error
due to its approximation.
#there is big error in K=10K1 for phase margin Asymptotic plot could be drawing error.