# finding PM and GM for a system

13 views (last 30 days)
Cait on 2 Nov 2022
Commented: William Rose on 3 Nov 2022
I need help finding PM and GM for this system.
Here is what I have so far, but I'm not sure if its right for the PM and GM. I tried a couple things, and this is the first that didn't give me an error, but the numbers just seem wrong.
Any help is appreciated!
% Part 1 - plot nyquist plot for K=900 G = tf([900],conv([1 10],[1 4 4])); figure(1) nyquist(G); xlim([-5 1])
% Part 2 - plot bode plot for transfer function figure(2) bode(G) [Gm,Pm,Wcg,Wcp] = margin(G) display(Gm); display(Pm);

William Rose on 2 Nov 2022
Your results look reasonable to me.
% Part 1 - plot nyquist plot for K=15
G = tf([900],conv([1 10],[1 4 4]));
figure(1)
nyquist(G);
ylim([-4 4]); axis equal
% Part 2 - plot bode plot for transfer function
figure(2)
bode(G); grid on
[Gm,Pm,Wcg,Wcp] = margin(G)
Warning: The closed-loop system is unstable.
Gm = 0.6400
Pm = -11.3799
Wcg = 6.6333
Wcp = 8.1166
display(Gm);
Gm = 0.6400
display(Pm);
Pm = -11.3799
The plots show an unstable system: when the phase is -180, which appears to be at f=650 Hz, the gain exceeds unity. That indicates the system is unstable. If you change 900 to 300, the system is stable, and the plots show that. For example, the phase plot below crosses -180 at f=650 Hz. The gain plot below shows that the gain is <0 dB at f=650, i.e. system is stable.
% Part 1 - plot nyquist plot for K=15
G = tf([300],conv([1 10],[1 4 4]));
figure(1)
nyquist(G);
ylim([-4 4]); axis equal
% Part 2 - plot bode plot for transfer function
figure(2)
bode(G); grid on
[Gm,Pm,Wcg,Wcp] = margin(G)
Gm = 1.9201
Pm = 19.5922
Wcg = 6.6333
Wcp = 4.8005
display(Gm);
Gm = 1.9201
display(Pm);
Pm = 19.5922
##### 2 CommentsShowHide 1 older comment
William Rose on 3 Nov 2022
@Cait, you're welcome. Good luck with your studies.

### Categories

Find more on Plot Customization in Help Center and File Exchange

R2022a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!