margin (MathScript RT Module Function)
- Updated2023-03-14
- 2 minute(s) read
margin (MathScript RT Module Function)
Owning Class: frqrsp
Requires: Control Design and Simulation Module and MathScript RT Module
Syntax
margin(SysInSISO)
margin(mag, pha, w)
gm = margin(SysInSISO)
[gm, gmf] = margin(SysInSISO)
[gm, gmf, pm] = margin(SysInSISO)
[gm, gmf, pm, pmf] = margin(SysInSISO)
[gm] = margin(mag, pha, w)
[gm, gmf, ] = margin(mag, pha, w)
[gm, gmf, pm] = margin(mag, pha, w)
[gm, gmf, pm, pmf] = margin(mag, pha, w)
Description
Calculates and/or plots the smallest gain and phase margins of a single-input single-output (SISO) system model. The gain margin indicates where the frequency response crosses at 0 decibels. The phase margin indicates where the frequency response crosses -180 degrees. Use the margins function to return all gain and phase margins of a SISO model.
Inputs
| Name | Description |
|---|---|
| SysInSISO | Specifies a linear time-invariant (LTI) model in transfer function, zero-pole-gain, or state-space form. |
| mag | Specifies the magnitude(s) of the model whose margins you want to calculate. mag is a real vector. |
| pha | Specifies the phase(s), in radians, of the model whose margins you want to calculate. mag is a real vector. |
| w | Specifies the frequency, in radians/second, of the model whose margins you want to calculate. w is a real scalar. |
Outputs
| Name | Description |
|---|---|
| gm | Returns the smallest gain margin of the SysInSISO model. gm is a real scalar. |
| gmf | Returns the gain margin frequency, in radians/second, that corresponds to the gm output. A gain margin frequency indicates where the model phase crosses -180 degrees. gmf is a real scalar. |
| pm | Returns the smallest phase margin of the SysInSISO model. pm is a real scalar. |
| pmf | Returns the phase margin frequency, in radians/second, that corresponds to the pm output. A phase margin frequency indicates where the model magnitude crosses 0 decibels. pmf is a real scalar. |
Details
The following table lists the support characteristics of this function.
| Supported in the LabVIEW Run-Time Engine | Yes (if you request output) |
| Supported on RT targets | Yes (if you request output) |
| Suitable for bounded execution times on RT | Not characterized |
Examples
num = [1]
den = [1, 5, 6]
SysInSISO = tf(num, den)
margin(SysInSISO)