﻿

# margins (MathScript RT Module Function)

LabVIEW 2012 Control Design and Simulation Module Help

Edition Date: June 2012

Part Number: 371894G-01

»View Product Info

Owning Class: frqrsp

Requires: Control Design and Simulation Module and MathScript RT Module

## Syntax

margins(SysInSISO)

s = margins(SysInSISO)

[gmf, gm] = margins(SysInSISO)

[gmf, gm, pmf] = margins(SysInSISO)

[gmf, gm, pmf, pm] = margins(SysInSISO)

Legacy Name: `allmargin`

## Description

Calculates all gain and phase margins of a single-input single-output (SISO) system model. The gain margins indicate where the frequency response crosses at 0 decibels. The phase margins indicate where the frequency response crosses -180 degrees. Use the margin function to return only the smallest gain and phase margins of a SISO model. If you do not request an output, this function returns the structure described in the S output description that follows.

Examples

## Inputs

Name Description
SysInSISO Specifies a linear time-invariant (LTI) SISO model in transfer function, zero-pole-gain, or state-space form.

## Outputs

Name Description
s Returns a structure with the following elements:
• GainMargin - Refer to the description of the gm output.
• GMFrequency - Refer to the description of the gmf output.
• PhaseMargin - Refer to the description of the pm output.
• PMFrequency - Refer to the description of the pmf output.
• DelayMargin - Lists the amounts of delay, in seconds, that would make the system unstable in a closed loop.
• DMFrequency - Specifies at which frequencies the system phase crosses -180 degrees or a multiple of -180. The i-th element of this vector corresponds to the i-th gain margin value in the DelayMargin vector.
• Stable - Returns 1 if the model is stable and 0 if the model is not stable.
gmf Returns the gain margin frequencies, in radians/second, of the SysInSISO model. A gain margin frequency indicates where the model phase crosses -180 degrees. The i-th element of this vector corresponds to the i-th element of the gm vector. gmf is a real vector.
gm Returns the gain margins of the SysInSISO model. gm is a real vector.
pmf Returns the phase margin frequencies, in radians/second, of the SysInSISO model. A phase margin frequency indicates where the model magnitude crosses 0 decibels. The i-th element of this vector corresponds to the i-th element of the pm vector. pmf is a real vector.
pm Returns the phase margins of SysInSISO. pm is a real vector.

## Details

The following table lists the support characteristics of this function.

 Supported in the LabVIEW Run-Time Engine Yes Supported on RT targets Yes Suitable for bounded execution times on RT Not characterized

## Examples

SysInSISO = tf([1, 1], [1, -1, 3])
[gmf, gm, pmf, pm] = margins(SysInSISO)