# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

## Stability Margin of a Simulink Model

This example illustrates how to compute the stability margins of the `airframemargin` model and compare the results with stability margins computed using the linearized model.

`airframemargin`

2. Define a margin analysis point at the output of the Airframe Model block.

`block1 = 'airframemargin/Airframe Model';`
3. Specify the output `az` of the Airframe Model block as a margin analysis point.

`port1 = 1;`
4. Compute stability margins.

`[cm,dm,mm] = loopmargin('airframemargin',block1,port1);`
5. View the classical gain and phase margins.

`cm`
```cm = GainMargin: [4.5652 2.5055e+003] GMFrequency: [7.1979 314.1593] PhaseMargin: 65.1907 PMFrequency: 2.1463 DelayMargin: 53.0113 DMFrequency: 2.1463 Stable: 1 ```
6. Compare the classical gain and phase margins `cm` with stability margins of the linearized model computed using `allmargin`:

```% Define linearization I/O points. io = linio('airframemargin/Airframe Model',1,'looptransfer'); % Linearize the model. lin_sys = linearize('airframemargin',io); % Compute gain and phase margins. cm_lin = allmargin(-lin_sys) ```
```cm_lin = GainMargin: [4.5652 2.5055e+003] GMFrequency: [7.1979 314.1593] PhaseMargin: 65.1907 PMFrequency: 2.1463 DelayMargin: 53.0113 DMFrequency: 2.1463 Stable: 1 ```

The gain and phase margins, `cm` and `cm_lin`, computed using the two approaches match.