Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: English - Français - 日本語 - Русский
Ajuda do Scilab >> CACSD > Linear Analysis > Stability > g_margin


gain margin and associated crossover frequency


[gm, fr] = g_margin(h)



a SISO linear system (see :syslin).


a number, the gain margin (in dB) if any of Inf


a number, the associated frequency in hertz, or an empty matrix if the gain margin does not exist.


Given a SISO linear system in continuous or discrete time, g_margin returns gm, the gain margin in dB of h and fr, the achieved corresponding frequency in Hz.

The gain margin, if it exists, is the minimal value of the system gain at points where the nyquist plot crosses the negative real axis. In other words the gain margin is 20*log10(1/g) where g is the open loop gain of h when the frequency response phase of h equals -180°

The algorithm uses polynomial root finder to solve the equations:


for the continuous time case.


for the discrete time case.


h=syslin('c',-1+%s,3+2*%s+%s^2) //continuous time case
h = syslin(0.1,0.04798*%z+0.0464,%z^2-1.81*%z+0.9048);//discrete time case
[g ,fr]=g_margin(h);

See also

  • p_margin — phase margin and associated crossover frequency
  • show_margins — display gain and phase margin and associated crossover frequencies
  • repfreq — frequency response
  • black — diagrama de Black (carta de Nichols)
  • bode — Bode plot
  • nicholschart — Nichols chart
  • nyquist — diagrama de Nyquist
Scilab Enterprises
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Mon Jan 03 14:35:23 CET 2022