L20E121 - Control Systems Lecture 20 Exercise 121: Phase and gain margins

MECE3350 Control Systems Lecture 20 Exercise 121: Phase and gain margins Lecture:    • Control Systems Lecture 20: Phase and gain...   Lecture notes: https://www.biomechatronics.ca/teaching/ Matlab code: clear all close all warning('off') s = tf([1 0],[1]); %define s as a transfer function i = 1; for k = 1:0.05:10; H = k*(s^2+0.1*s+0.5)/(s*(s+1)*(s^2+0.05*s+0.5)*(s+2)); [Gm,Pm,Wcg,Wcp] = margin(H); PhaseM(i) = Pm; GainM(i) = Gm; K(i) = k; i = i+1; end yyaxis left plot(K, PhaseM); yyaxis right plot(K, GainM); yyaxis left title('Phase and gain margins') xlabel('k') ylabel('phase margin [deg]') yyaxis right ylabel('Gain Margin [dB]') xlim([0.59 9.59]) ylim([0.59 5.59])