I am wondering if anyone knows why MATLAB returns an incorrect value for gain margin when using margin() with a system that is open-loop unstable, or whether this is a bug that should be reported.
See the following example:
>> Gol1Gol1 = 0.00074321 (z+0.9875) --------------------- (z-1.001) (z-0.9619)Sample time: 0.04 secondsDiscrete-time zero/pole/gain model.>> [Gm,Pm,Wgm,Wpm]=margin(Gol1)Gm = 0.0316Pm = 48.7296Wgm = 0Wpm = 0.7615
Manually applying the Jury stability criterion to the above discrete-time system results in a range of stability of 0 < K < ~50.6. margin(), on the other hand, returns a gain margin of -30dB/0.0316 at 0 rad/s for some reason.
The bode plots generated using margin() or bode() clearly shows the -180deg phase crossover near ~6.8 rad/s with ~34dB of gain margin, which is the correct result. Why does margin() return the wrong Gm and Wgm values?
Best Answer