Main Content

allmargin

Gain margin, phase margin, delay margin, and crossover frequencies

Description

example

S= allmargin(L)computes the gain margin, phase margin, delay margin, and the corresponding crossover frequencies for the SISO or MIMO negative feedback loop with open-loop responseL. The negative feedback loop is computed asfeedback(L,eye(M)), whereM输入和o的数量吗utputs inL.

For a MIMO system,allmarginreturns loop-at-a-time stability margins for the negative-feedback closed loop system. Useallmarginto find classical margins of any SISO or MIMO model, including models with delays.

example

S= allmargin(mag,phase,w,ts)computes the stability margins from the frequency response datamag,phase,w, and the sample time,ts.

Examples

collapse all

For this example, consider a SISO open-loop transfer functionLgiven by,

L = 2 5 s 3 + 1 0 s 2 + 1 0 s + 1 0

L = tf(25,[1 10 10 10]);

Find the stability margins ofL.

S = allmargin(L)
S =struct with fields:GainMargin: 3.6000 GMFrequency: 3.1623 PhaseMargin: 29.1104 PMFrequency: 1.7844 DelayMargin: 0.2847 DMFrequency: 1.7844 Stable: 1

The outputSis a structure with the classical margins and their respective crossover frequencies of the negative feedback loop ofL.

For this example, consider a MIMO state-space modelLwith 2 inputs and 2 outputs.

Load the data.

load('mimoStateSpaceModel.mat','L')

Find the classical margins for the MIMO system.

S = allmargin(L)
S=2×1 struct array with fields:Gainmargin gmfquency phasemargin pmfrequency delaymargin dmfquency稳定

The outputSis a 2-by-1 structure array of classical margins and their respective crossover frequencies. For instance,S(1)refers to the stability margins of the first I/O feedback channel with all other loops closed.

For this example, loadinvertedPendulumArray.mat, which contains a 3-by-3 array of inverted pendulum SISO models. The mass of the pendulum varies as you move from model to model along a single column ofsys, and the length of the pendulum varies as you move along a single row. The mass values used are 100g, 200g and 300g, and the pendulum lengths used are 3m, 2m and 1m respectively.

C o l u m n 1 C o l u m n 2 C o l u m n 3 R o w 1 1 0 0 g , 3 m 1 0 0 g , 2 m 1 0 0 g , 1 m R o w 2 2 0 0 g , 3 m 2 0 0 g , 2 m 2 0 0 g , 1 m R o w 3 3 0 0 g , 3 m 3 0 0 g , 2 m 3 0 0 g , 1 m

load('invertedPendulumArray.mat',“系统”); size(sys)
3x3 array of transfer functions. Each model has 1 outputs and 1 inputs.

Find stability margins for all models in the array.

S = allmargin(sys)
S=3×3 struct array with fields:Gainmargin gmfquency phasemargin pmfrequency delaymargin dmfquency稳定

allmarginreturns a 3-by-3 structure arrayS, in which each entry is a structure containing the stability margins of the corresponding entry insys. For instance, the stability margins of the model with 100g pendulum weight and 2m length is contained inS(1,2).

For this example, load the frequency response data of an open loop system, consisting of magnitudesmand phase valuespmeasured at the frequencies inw.

load('openLoopFRData.mat','m','p','w','ts');

Compute stability margins using the frequency response data.

S = allmargin(m,p,w,ts)
S =struct with fields:GainMargin: 0.6249 GMFrequency: 1.2732 PhaseMargin: [-90.0000 48.9853] PMFrequency: [1.0000 1.5197] DelayMargin: [4.7124 0.5626] DMFrequency: [1.0000 1.5197] Stable: NaN

The outputSis a structure with the classical margins and their respective crossover frequencies. Sinceallmargincannot assess the stability for frequency response data models,S.Stable = NaN.

Input Arguments

collapse all

Open-loop response, specified as a dynamic system model.Lcan be SISO or MIMO, as long as it has the same number of inputs and outputs.allmargincomputes the classical stability margins for the negative-feedback closed-loop systemfeedback(L,eye(M)):

To compute the stability margins of the positive feedback systemfeedback(L,eye(M),+1), useallmargin(-L).

When you have a controllerPand a plantC, you can compute the stability margins for gain and phase variations at the plant inputs or outputs. From the following diagram:

  • To compute margins at the plant outputs, setL = P*C.

  • To compute margins at the plant inputs, setL = C*P.

Lcan be continuous time or discrete time. IfLis a generalized state-space model (genssoruss), thenallmargin用途the current or nominal value of all control design blocks inL.

IfLis a frequency-response data model (such asfrd), thenallmargincomputes the margins at each frequency represented in the model. The function returns the margins at the frequency with the smallest stability margin.

IfLis a model array, thenallmargincomputes margins for each model in the array.

Magnitude of the system response in absolute units, specified as a 3-D array.magis an M-by-M-by-N array, where M is the number of inputs or outputs, and N is the number of frequency points. For more information on obtainingmag, seeObtain Magnitude and Phase DataandMagnitude and Phase of MIMO System.

Phase of the system response in degrees, specified as a 3-D array.phaseis an M-by-M-by-N array, where M is the number of inputs or outputs, and N is the number of frequency points. For more information on obtainingphase, seeObtain Magnitude and Phase DataandMagnitude and Phase of MIMO System.

Frequencies at which the magnitude and phase values of system response are obtained, specified as a column vector. You can provide the frequency vectorwin any units;allmarginreturns frequencies in the same units.allmargininterpolates between frequency points to approximate the true stability margins.

Sample time, specified as an integer.allmargin用途tsto find the stability margins from frequency response data.

  • For continuous-time models, setts = 0.

  • For discrete-time models,tsis a positive integer representing the sampling period. To denote a discrete-time model with unspecified sample time, setts = -1.

Output Arguments

collapse all

Gain, phase, and delay margins, returned as a structure array.

The outputSis a structure with the following fields:

  • GMFrequency: All -180° (modulo 360°) crossover frequencies inrad/TimeUnit, whereTimeUnitis the time units, specified in theTimeUnitproperty ofL.

  • GainMargin: Corresponding gain margins, defined as1/G, whereGis the gain at the -180° crossover frequency. Gain margins are in absolute units.

  • PMFrequency: All 0-dB crossover frequencies inrad/TimeUnit, whereTimeUnitis the time units, specified in theTimeUnitproperty ofL.

  • PhaseMargin: Corresponding phase margins in degrees.

  • DMFrequencyandDelayMargin:DelayMarginis the maximum amount of delay that the system can tolerate before it loses stability.DMFrequencycontains critical frequencies corresponding to the delay margins. Delay margins are specified in the time units of the system for continuous-time systems and multiples of the sample time for discrete-time systems.

  • Stable:1if the nominal closed-loop system is stable,0if unstable, andNaNif stability cannot be assessed. In general,allmargincannot assess the stability of anfrdsystem.

WhenLis an M-by-M MIMO system,Sis an M-by-1 structure array. For instance,S(j)gives the stability margins for the j-th feedback channel with all other loops closed (one-loop-at-a-time margins).

Tips

  • allmarginassumes that the system with open-loop responseLis a negative-feedback system. To compute the classical stability margins of the positive feedback systemfeedback(L,eye(M),+1), useallmargin(-L).

  • To compute classical margins for a system modeled in Simulink®, first linearize the model to obtain the open-loop response at a particular operating point. Then, useallmarginto compute classical stability margins for the linearized system. For more information, seeStability Margins of a Simulink Model(Robust Control Toolbox).

Version History

Introduced before R2006a

See Also

||(Robust Control Toolbox)

Topics