Calculation of gain margin fails

Notice that the phase curve never crosses -180 degrees, so the margin command is slightly confused. You can evaluate the margin exactly at the Nyquist frequency

julia> margin(ol_sys, [100pi])
(wgm = [314.1592653589793;;], gm = [2.0;;], wpm = [NaN;;], pm = [Inf;;])

Gain and phase margins are primitive measures of robustness, I’d consider using the diskmargin instead

plot(RobustAndOptimalControl.diskmargin(ol_sys))

image


Here’s a PR fixing margin in this case

2 Likes