Gain/phase margin calculated relative to -540.
6 views (last 30 days)
Show older comments
I am an assistant lecturer for an undergrad control course. Given the following system students are asked to calculate the gain and phase margins.
I came accross the following issue while checking some work. The system is created and is clearly unstable due to the dead-time. I use margin to plot and calculate the required values. However, margin calculates both the gain and phase margins relative to -540° instead of -180°.
G = tf(50, poly([-2 -5]),'IODelay',1);
margin(G,{0.1,12})
[GM, PM] = margin(G)
I understand that it will pick up phase crossover modulo 360° (as seen when using allmargin)
allmargin(G)
and according to the margin documentation it is supposed to return the minimum margins, which in this case should be GM=0.303 (or -10.37 dB).
What causes this to fail? And why is the phase margin calculated relative to a 180° +-k360° if it does actually cross -180°?
0 Comments
Accepted Answer
Andrew Ouellette
on 10 Nov 2022
Edited: Andrew Ouellette
on 11 Nov 2022
Hi Jaco-Louis,
From the documentation page for margin:
the smallest gain margin (the one closest to 0dB) is returned when there are multiple crossover frequencies.
Since 2.28 dB is closer to 0dB than -10.37dB, this output is expected.
2 Comments
Andrew Ouellette
on 11 Nov 2022
I agree with your analysis- I misspoke in my previous reply about the negative gain margin, so I have edited out that portion of my answer.
The help text for "margin" which you can access from executing the following command:
help margin
Includes this bit: "If there are several crossover points, margin returns the smallest margins (gain margin nearest to 0dB and phase margin nearest to 0 degrees)."
This description is not present in the documentation page for "margin", so I will be forwarding this oversight to the approprirate team.
The "allmargin" command you mentioned previously does appear to include the relevant margins for determining stability.
More Answers (1)
Paul
on 13 Nov 2022
Edited: Paul
on 13 Nov 2022
Hi Jaco-Louis
From the Question: "... according to the margin documentation it is supposed to return the minimum margins, which in this case should be GM=0.303 (or -10.37 dB). What causes this to fail? And why is the phase margin calculated relative to a 180° +-k360° if it does actually cross -180°?
As to the first question, as has already been answered by @Andrew Ouellette, margin uses the closest to 0 db as the minimum gain margin, and I assume that this really means closest in an absolute value sense, i.e., margin() could return a negative margin if it was closest to 0 dB. I agree with you that margin could be much more clear about its criterion. Having said that, it's not clear to me if you would prefer that margin() use the absolute margin rather than dB margin. If so, as in this example, any "negative" margin will always be smaller ( < 1) than any "positive" margin (> 1). Some people compare margins by distance to the -1 point, so a
db(.5)
gain margin is the same as a
db(1.5)
gain margin.
As to the second question, the gain margin(s) (not the phase margin) is computed at the 180 + k*360 crossovers, as shown in the results from allmargin. I'm not sure what the concern is (or was?).
Finally, I'd like to point out that a "negative margin" does not, by itself, indicate the closed-loop system is unstable. A stable, closed-loop system can have one (or more) negative gain margins. I think (but don't quote me) that an an open-loop, unstable system must have at least one negative gain margin for the closed-loop sytem to be stable. Stable, open-loop systems can also have negative gain margins when the closed-loop system is stable. Furthermore, if the closed-loop system is unstable, as in this Question, the smallest "gain margin" does not, in general, indicate how much the loop gain needs to be increased (or decreased if a "negative margin") to recover closed-loop stabiity. That determination also needs to factor in the number of unstable, open-loop poles.
0 Comments
See Also
Categories
Find more on Control System Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!