margin (Control Design and Simulation Module, MathScript Function)
Member of the frqrsp class.
Syntax
margin(SysInSISO)
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 allmargin 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. |
Examples
num = [1]den = [1, 5, 6]
SysInSISO = tf(num, den)
margin(SysInSISO)