g_margin - gain margin
returns gm, the gain margin in dB of h (SISO plant) and fr, the achieved corresponding frequency in hz. The gain margin is values of the system gain at points where the nyquist plot crosses the negative real axis.
h=syslin('c',-1+%s,3+2*%s+%s^2) [g,fr]=g_margin(h) [g,fr]=g_margin(h-10) nyquist(h-10)