loopmargin
(Not recommended) Stability margin analysis of LTI and Simulink feedback loops
loopmargin is not recommended. Use diskmargin or
allmargin instead. For more information, see Version History.
Syntax
[cm,dm,mm] = loopmargin(L)
[m1,...,mn] = loopmargin(L,MFLAG)
[cmi,dmi,mmi,cmo,dmo,mmo,mmio] = loopmargin(P,C)
[m1,...,mn] = loopmargin(P,C,MFLAG)
[cm,dm,mm] = loopmargin(Model,Blocks,Ports)
[cm,dm,mm,info] = loopmargin(Model,Blocks,Ports,OP)
[m1,...,mn,info] = loopmargin(Model,Blocks,Ports,MFLAG)
[m1,...,mn,info]
= loopmargin(Model,Blocks,Ports,OP,MFLAG)
Description
[cm,dm,mm] = loopmargin(L) analyzes the multivariable feedback loop
consisting of the loop transfer matrix L (size
N-by-N) in negative feedback with an
N-by-N identity matrix.
cm, or classical gain and phase margins, is an N-by-1
structure corresponding to loop-at-a-time gain and phase margins for each channel.
L is an LTI model. Use -L to specify positive
feedback.
dm is an N-by-1 structure corresponding to
loop-at-a-time disk gain and phase margins for each channel. The disk margin for the i-th
feedback channel defines a circular region centered on the negative real axis at the average
GainMargin (GM), e.g. ,
(GMlow+GMhigh)/2,
such that L(i,i) does not enter that region. Gain and phase disk margin bounds
are derived from the radius of the circle, calculated based on the balanced sensitivity
function.
mm, the multiloop disk margin, is a structure. mm
describes how much independent and concurrent gain and phase variation can occur independently in
each feedback channel while maintaining stability of the closed-loop system. Note that
mm is a single structure, independent of the number of channels. This is
because variations in all channels are considered simultaneously. As in the case for disk margin,
the guaranteed bounds are calculated based on a balanced sensitivity function.
[m1,...,mn] = loopmargin(L,MFLAG) returns a subset of the margins,
specified by the character vector MFLAG. This optional argument may be any
combination, in any order, of the 3 characters 'c', 'd' and
'm'. For example, [m1,m2] = loopmargin(L,'m,c') returns
the multi-loop disk margin ('m') in m1, and the classical
margins ('c') in m2. Use 'd' to specify
the disk margin.
[cmi,dmi,mmi,cmo,dmo,mmo,mmio] = loopmargin(P,C)
analyzes the multivariable feedback loop consisting of the controller C in
negative feedback with the plant, P. C should only be the
compensator in the feedback path, without reference channels, if it is a two-degree-of-freedom
(2-dof) architecture. That is, if the closed-loop system has a 2-dof architecture the reference
channel of the controller should be eliminated, resulting in a 1-dof architecture, as
shown.

cmi,dmi and mmi structures correspond to the classical
loop-at-a-time gain and phase margins, disk margins and multiloop channel margins at the plant
input respectively. The structures cmo, dmo and
mmo have the same fields as described for cmi,
dmi and mmi though they correspond to the plant outputs.
mmio, or multi-input/multi-output margins, is a structure corresponding to
simultaneous, independent, variations in all the individual input and output channels of the
feedback loops. mmio has the same fields as mmi and
mmo.
[m1,...,mn] = loopmargin(P,C,MFLAG) returns a subset of the margins,
specified by MFLAG. This optional argument may be any combination, in any
order, of the 7 character pairs 'ci', 'di',
'mi', 'co', 'do,
'mo', and 'mm'. For example,[m1,m2,m3] =
loopmargin(P,C,'mo,ci,mm') returns the multi-loop disk margin at the plant output
('mo') in m1, the classical margins at the plant input
('ci') in m2, and the multi-loop disk margins for
simultaneous, independent variations in all input and output channels ('mm')
in m3.
Usage with Simulink
[cm,dm,mm] = loopmargin(Model,Blocks,Ports) does a multi-loop
stability margin analysis using Simulink®
Control Design™ software. Model specifies the name of the Simulink diagram for analysis. The margin analysis points are defined at the output ports
(Ports) of blocks (Blocks) within the model.
Blocks is a cell array of full block path names and Ports
is a vector of the same dimension as Blocks. If all Blocks
have a single output port, then Ports would be a vector of ones with the same
length as Blocks.
Three types of stability margins are computed: loop-at-a-time classical gain and phase
margins (cm), loop-at-a-time disk margins (dm) and a
multi-loop disk margin (mm).
[cm,dm,mm] = loopmargin(Model,Blocks,Ports,OP) uses the operating point
object OP to create linearized systems from the Simulink
Model.
[cm,dm,mm,info] = loopmargin(Model,Blocks,Ports,OP) returns
info in addition to the margins. info is a structure with
fields OperatingPoint, LinearizationIO and
SignalNames corresponding to the analysis.
[m1,...,mn,info] = loopmargin(Model,Blocks,Ports,MFLAG) and
[m1,...,mn,info]
= loopmargin(Model,Blocks,Ports,OP,MFLAG) return a subset
of the margins, specified by the character vector MFLAG. This optional
argument may be any combination, in any order, of the 3 characters 'c',
'd' and 'm'. For example, [m1,m2] =
loopmargin(Model,Blocks,Ports,'m,c') returns the multi-loop disk margin
('m') in m1, and the classical margins
('c') in m2. Use 'd' to specify the
disk margin.
Basic Syntax
[cm,dm,mm] = loopmargin(L) cm is calculated using the
allmargin command and has the same fields as allmargin.
The output cm is an N-by-1 structure of classical gain and phase margins for
each feedback channel with all other loops closed. cm has the following
fields:
Field | Description |
|---|---|
GMFrequency | All –180 deg crossover frequencies (in radians-per-second) |
GainMargin | Corresponding gain margins ( |
PhaseMargin | Corresponding phase margins (in degrees) |
PMFrequency | All 0 dB crossover frequencies (in radians-per-second) |
DelayMargin | Delay margins (in seconds for continuous-time systems, and multiples of the sample time for discrete-time systems) |
Stable | 1 if nominal closed loop is stable, 0 otherwise. If |
dm, or Disk Margin, is an N-by-1 structure of disk margins for each
feedback channel with all other loops closed. dm has the following fields:
Field | Description |
|---|---|
GainMargin | Smallest gain variation ( |
PhaseMargin | Smallest phase variation, in degrees, corresponding to the disk described in
the |
Frequency | Frequency with the weakest disk margin, in rad/ For |
mm is a structure with the following fields.
Field | Description |
|---|---|
GainMargin | Guaranteed bound on simultaneous, independent, gain variations allowed in all plant channels. |
PhaseMargin | Guaranteed bound on simultaneous, independent, phase variations allowed in all plant channels (degrees). |
Frequency | Frequency with the weakest disk margin, in rad/ For |
Relationship Between Disk Margin and Gain and Phase Margins
The disk margin is based on a multiplicative uncertainty model in which the loop gain L of each loop channel becomes
where Δ is complex. The uncertainty size α is the disk margin. The uncertain quantity (1 + Δ)/(1 – Δ) has a gain component and a phase component. Thus, enforcing a disk margin α also enforces minimum gain and phase margins given by
with GM in absolute units and PM in degrees. The gain and phase margins are therefore related by
When you specify independent gain and phase margins for tuning, the software chooses the smallest α that enforces both values, which is
Note that GM and PM are not the same as the classical gain and phase margins. Rather, they provide stronger guarantees of stability, because both of the following can occur at the same time without loss of stability:
The loop gain can increase or decrease by a factor of GM, and
The loop phase can increase or decrease by PM degrees.
By contrast, the classical gain and phase margins consider only gain variations or phase variations at a single frequency, the crossover frequency.
Examples
Algorithms
Two well-known loop robustness measures are based on the sensitivity function S=(I–L)–1 and the complementary sensitivity function T=L(I–L)–1 where L is the loop gain matrix associated with the input or output loops broken simultaneously. In the following figure, S is the transfer matrix from summing junction input u to summing junction output e. T is the transfer matrix from u to y. If signals e and y are summed, the transfer matrix from u to e+y is given by (I+L)· (I–L)–1, the balanced sensitivity function. It can be shown (Dailey, 1991, Blight, Daily and Gangass, 1994) that each broken-loop gain can be perturbed by the complex gain (1+Δ)(1–Δ) where |Δ|<1/µ(S+T) or |Δ|<1/σmax(S+T) at each frequency without causing instability at that frequency. The peak value of µ(S+T) or σmax(S+T) gives a robustness guarantee for all frequencies, and for µ(S+T) the guarantee is nonconservative (Blight, Daily and Gangass, 1994).

This figure shows a comparison of a disk margin analysis with the classical notations of gain and phase margins.

The Nyquist plot is of the loop transfer function L(s)
The Nyquist plot of L corresponds to the blue line.
The unit disk corresponds to the dotted red line.
GM and PM indicate the location of the classical gain and phase margins for the system L.
DGM and DPM correspond to the disk gain and phase margins. The disk margins provide a lower bound on classical gain and phase margins.
The disk margin circle corresponds to the dashed black line. The disk margin corresponds to the largest disk centered at (GMD + 1/GMD)/2 that just touches the loop transfer function L. This location is indicated by the red dot.
The disk margin and multiple channel margins calculation involve the balanced sensitivity
function S+T. For a given peak value of
µ(S+T), any simultaneous phase and gain variations applied
to each loop independently will not destabilize the system if the perturbations remain inside the
corresponding circle or disk. This corresponds to the disk margin calculation to find
dmi and dmo.
Similarly, the multiple channel margins calculation involves the balanced sensitivity function S+T. Instead of calculating µ(S+T) a single loop at a time, all the channels are included in the analysis. A µ-analysis problem is formulated with each channel perturbed by an independent, complex perturbation. The peak µ(S+T) value guarantees that any simultaneous, independent phase and gain variations applied to each loop simultaneously will not destabilize the system if they remain inside the corresponding circle or disk of size µ(S+T).
For frequency-response data (frd) models,
loopmargin uses the techniques of μ-analysis to compute
the disk margin at each frequency point in the model, and returns the weakest margin of these
values. For all other models, the μ-analysis computation identifies the
frequency with the weakest margin.
References
Barrett, M.F., Conservatism with robustness tests for linear feedback control systems, Ph.D. Thesis, Control Science and Dynamical Systems, University of Minnesota, 1980.
Blight, J.D., R.L. Dailey, and D. Gangsass, “Practical control law design for aircraft using multivariable techniques,” International Journal of Control, Vol. 59, No. 1, 1994, pp. 93-137.
Bates, D., and I. Postlethwaite, “Robust Multivariable Control of Aerospace Systems,” Delft University Press, Delft, The Netherlands, ISBN: 90-407-2317-6, 2002.
Version History
Introduced before R2006aSee Also
allmargin | diskmargin | loopsens | robstab | wcgain | wcdiskmargin

