assessing gain and phase margins -凯发k8网页登录
this example shows how to examine the effect of stability margins on closed-loop response characteristics of a control system.
stability of a feedback loop
stability generally means that all internal signals remain bounded. this is a standard requirement for control systems to avoid loss of control and damage to equipment. for linear feedback systems, stability can be assessed by looking at the poles of the closed-loop transfer function. consider for example the siso feedback loop:
figure 1: siso feedback loop.
for a unit loop gain k
, you can compute the closed-loop transfer function t
using:
g = tf([.5 1.3],[1 1.2 1.6 0]); t = feedback(g,1);
to obtain the poles of t
, type
pole(t)
ans = -0.2305 1.3062i -0.2305 - 1.3062i -0.7389 0.0000i
the feedback loop for k=1
is stable since all poles have negative real parts.
how stable is stable?
checking the closed-loop poles gives us a binary assessment of stability. in practice, it is more useful to know how robust (or fragile) stability is. one indication of robustness is how much the loop gain can change before stability is lost. you can use the root locus plot to estimate the range of k
values for which the loop is stable:
rlocus(g)
clicking on the point where the locus intersects the y axis reveals that this feedback loop is stable for
this range shows that with k=1
, the loop gain can increase 270% before you lose stability.
gain and phase margins
changes in the loop gain are only one aspect of robust stability. in general, imperfect plant modeling means that both gain and phase are not known exactly. because modeling errors are most damaging near the gain crossover frequency (frequency where open-loop gain is 0db), it also matters how much phase variation can be tolerated at this frequency.
the phase margin measures how much phase variation is needed at the gain crossover frequency to lose stability. similarly, the gain margin measures what relative gain variation is needed at the gain crossover frequency to lose stability. together, these two numbers give an estimate of the "safety margin" for closed-loop stability. the smaller the stability margins, the more fragile stability is.
you can display the gain and phase margins on a bode plot as follows. first create the plot:
bode(g), grid
then, right-click on the plot and select the characteristics -> minimum stability margins submenu. finally, click on the blue dot markers. the resulting plot is shown below:
this indicates a gain margin of about 9 db and a phase margin of about 45 degrees. the corresponding closed-loop step response exhibits about 20% overshoot and some oscillations.
step(t), title('closed-loop response for k=1')
if we increase the gain to k=2
, the stability margins are reduced to
[gm,pm] = margin(2*g); gmdb = 20*log10(gm) % gain margin in db pm % phase margin in degrees
gmdb = 2.7435 pm = 8.6328
and the closed-loop response has poorly damped oscillations, a sign of near instability.
step(feedback(2*g,1)), title('closed-loop response for k=2')
systems with multiple gain or phase crossings
some systems have multiple gain crossover or phase crossover frequencies, which leads to multiple gain or phase margin values. for example, consider the feedback loop
figure 2: feedback loop with multiple phase crossovers
the closed-loop response for k=1
is stable:
g = tf(20,[1 7]) * tf([1 3.2 7.2],[1 -1.2 0.8]) * tf([1 -8 400],[1 33 700]);
t = feedback(g,1);
step(t), title('closed-loop response for k=1')
to assess how robustly stable this loop is, plot its bode response:
bode(g), grid
then, right-click on the plot and select the characteristics -> all stability margins submenu to show all the crossover frequencies and associated stability margins. the resulting plot is shown below.
note that there are two 180 deg phase crossings with corresponding gain margins of -9.35db and 10.6db. negative gain margins indicate that stability is lost by decreasing the gain, while positive gain margins indicate that stability is lost by increasing the gain. this is confirmed by plotting the closed-loop step response for a plus/minus 6db gain variation about k=1
:
k1 = 2; t1 = feedback(g*k1,1); k2 = 1/2; t2 = feedback(g*k2,1); step(t,'b',t1,'r',t2,'g',12), legend('k = 1','k = 2','k = 0.5')
the plot shows increased oscillations for both smaller and larger gain values.
you can use the command allmargin
to compute all stability margins. note that gain margins are expressed as gain ratios, not db. use mag2db
to convert the values to db.
m = allmargin(g) gainmargins_db = mag2db(m.gainmargin)
m = struct with fields: gainmargin: [0.3408 3.3920] gmfrequency: [1.9421 16.4807] phasemargin: 68.1140 pmfrequency: 7.0776 delaymargin: 0.1680 dmfrequency: 7.0776 stable: 1 gainmargins_db = -9.3510 10.6091
see also
| | (robust control toolbox)