# margin

Margin stability.

## Syntax

margin(sys)

margin(sys, tol)

[gm, pm, Wgm, Wpm] = margin(...)

## Inputs

- sys
- A linear time-invariant transfer function or state-space system.
- tol
- The tolerance below which small values are ignored (default: sqrt(eps)).

## Outputs

- gm
- The gain margin as a ratio, not in decibels.
- p
- The phase margin in degrees.
- Wgm
- The frequency at which the gain margin is assessed, also known as the phase crossover.
- Wpm
- The frequency at which the phase margin is assessed, also known as the gain crossover.

## Example

```
s = tf('s');
GH = 10000 / ((s+10)*(s+20)*(s+30));
margin(GH);
```

## Comments

If the output arguments are omitted, the bode plot is displayed with the margin information.