Step 5: frequency response, the Bode plot and stability margins, from an animation of a hand shaking a weight to the margins of the loop function.
CDSSC · Step 5 · last review step before the Fundamentos de Realimentación block
Frequency response and Bode plots (respuesta en frecuencia, diagrama de Bode)
So far we asked: what does a system do when a step suddenly appears at its input? Here we ask something else: what does it do when we shake it rhythmically, sometimes slowly, sometimes fast? We go slowly, one step at a time:
1 Shaking a weight · 2 From measurements to a plot · 3 Why s = jω · 4 Decibels · 5 Blocks · 6 Bode step by step · 7 Bandwidth and hump · 8 Playground · 9 Margins · 10 Five applications · 11 Traps · 12 MATLAB · 13 Check yourself · 14 Summary
1 · Shaking a weight on a rubber band
You hold a rubber band with a weight hanging from it. You move your hand up and down at a steady rhythm. The input is the hand's motion u(t), the output is the weight's motion y(t). Change the rhythm with the slider (or click an orange marker under it) and watch the weight. After each change wait a few seconds: the weight needs a moment to “tune in”.
hand rhythm
hand (input u)weight (output y)right part: last 8 seconds, newest on the right
What you see at three rhythms:
Slowly: the weight moves with the hand, the same amount and at the same moment.
At the weight's own rhythm (like a swing pushed at the right moment): the weight jumps much more than the hand. This is resonance.
Fast: the weight barely moves and goes the opposite way: hand up, weight down. Its inertia cannot keep up.
“Its own rhythm”? The weight doesn't bounce by itself. True, something has to start the motion. There are two different situations:
Free oscillation (vibraciones libres): the hand jerks once and stops. The weight keeps bouncing, weaker and weaker, until it stops. The tempo of these bounces is its natural frequency (frecuencia natural)\omega_n. The hand doesn't set it: it comes from the band and the weight (stiffer band → faster, heavier weight → slower).
Forced oscillation (vibraciones forzadas): the hand shakes all the time. The weight moves at the hand's tempo, not its own. This is the situation of this lesson.
Resonance (resonancia) = the forced oscillation hits the tempo of the free oscillation. Then every push goes with the motion, so energy adds up cycle after cycle. Like a bell: strike it once and it rings at its own tone, the tone it “likes”.
The key point: in every case the weight, after a while, oscillates at the same rhythm as the hand. Only two numbers change, and each has its own math symbol:
1. Magnitude (módulo, ganancia)
|G(j\omega)|=\frac{\text{amplitude of }y}{\text{amplitude of }u}
The vertical bars |\ | mean “the size of”. Hand ±1 cm, weight ±3 cm → |G|=3. What G(j\omega) itself is comes in part 3; for now read it as “the system's answer at rhythm ω”.
The angle sign \angle (or the letter \varphi, phi) means “the angle of”. A whole period = 360°. Late by a quarter period → \varphi=-90^\circ (minus, because it is a delay).
Why doesn't the rhythm change? Right after a rhythm change the weight does two things at once: it oscillates with its own motion (this dies out, because the band and the air brake it) and it oscillates at the hand's rhythm (this stays, because the hand keeps pushing). After a while only the hand's rhythm is left. On the slides this is SS-07 p.14, bottom row: “entrada sinusoidal” → first “transitorio”, then “régimen permanente”, the steady state. A linear system can only multiply a signal and delay it; it cannot change its rhythm.
Try it yourself. The hand moves ±2 cm, the weight ±6 cm and lags by a quarter period. What are the magnitude and the phase?
Magnitude = output amplitude ÷ input amplitude. Phase: a quarter of 360° is how many degrees? A delay gets a minus sign.
|G|=6/2=3 (the weight moves 3 times as much as the hand). A quarter period = 360° / 4 = 90°, a delay, so \varphi=-90^\circ. You see exactly this with the “resonance” button.
2 · From measurements to a Bode plot
Imagine an experiment: set a rhythm, wait until the weight settles, write down |G| and \varphi. Then the next rhythm. If you plot these measurements you get a Bode plot (diagrama de Bode). It always has two floors, one under the other:
Top plot: magnitude|G(j\omega)|: how many times bigger the output is than the input.
Bottom plot: phase\angle G(j\omega): how many degrees the output lags.
Horizontal axis (shared): the rhythm \omega in rad/s. It is logarithmic: from 0.1 to 1 takes the same space as from 1 to 10 and from 10 to 100, so very slow and very fast rhythms fit on one plot.
The rhythm \omega (omega) is “radians per second”. One full up-and-down motion is 2\pi radians, so \omega=2\pi f, where f is the number of motions per second (Hz).
Measuring bench. Left: the same weight (smaller), with its own rhythm slider. Right: your measurements. Set a rhythm, wait until the weight's swing stops changing, click “save”.
rhythm
magnitude |G|: how many times more the weight moves
phase ∠G: the weight's delay in degrees
your measurementsfull curve|G| = 1 (dashed)
Save a few points (slow, resonance, fast), then click “show the full curve”. The curve passes through your measurements: a Bode plot is simply all such measurements at once.
3 · Computing instead of measuring: why s = jω
We don't want to build an experiment every time. We have a model of the system: the transfer function G(s) (función de transferencia), a fraction in s. The question of this part: what do we put in for s to get |G| and \varphi for the rhythm \omega? To answer it we first need to know what s means.
Step A: every signal has its own s
The signals in this course are built from one brick, the exponential e^{st}, where s=\sigma+j\omega is a complex number. Split it into two factors:
e^{st}=e^{(\sigma+j\omega)t}=\underbrace{e^{\sigma t}}_{\text{size: grows or dies}}\cdot\underbrace{e^{j\omega t}}_{\text{rotation: the rhythm}}
e^{j\omega t}=\cos\omega t+j\sin\omega t (Euler's formula) is an arrow of length 1 spinning ω radians per second. Its length is always 1, so it only makes the rhythm, never growth.
All the growing or dying comes from e^{\sigma t}: \sigma<0 dies, \sigma>0 grows, \sigma=0 gives e^{0}=1, the size stays put.
signal
built from
its s
σ
what it does
step 1
e^{0t}
0
0
constant
e^{-2t}
e^{-2t}
−2
−2
dies, no swing
\sin 3t
\dfrac{e^{3jt}-e^{-3jt}}{2j}
±3j
0
swings forever, same height
e^{-0.5t}\sin 3t
e^{(-0.5\pm3j)t}
−0.5 ± 3j
−0.5
swings and dies (a bell after a hit)
e^{0.3t}\sin 3t
e^{(0.3\pm3j)t}
0.3 ± 3j
+0.3
swings and grows (unstable)
So why does a sine have σ = 0? Because a sine is made only of the spinning part e^{\pm j\omega t}, with no e^{\sigma t} factor in front. Anything with a growing or dying envelope (a struck bell, an unstable oscillation) has \sigma\ne0. These s values are exactly the poles of each signal's Laplace transform: SS-04 p.12, \mathcal{L}\{\sin\omega t\}=\dfrac{\omega}{s^2+\omega^2} has poles at \pm j\omega.
Play with σ for the signal e^{\sigma t}\cos 3t:
σ (grows / dies)
signal e^{σt}·cos(3t) and its envelope
signalenvelope ±e^{σt} (dashed)zero line
Try it yourself. What is the s of the signal e^{-3t}\cos 2t? Give σ and ω (the positive one).
The number in the exponent of e is σ. The number multiplying t inside the cosine is ω.
s=-3\pm2j: σ = −3 (dies fast), ω = 2 (rhythm).
Careful: two different kinds of s. Don't mix them.
The system's own poles (its modes): fixed by the system. The weight on the band has poles at -0.47\pm3.1j: σ ≠ 0, lightly damped, ζ = 0.15. Frequency response does not change them. They decide the transient that dies out after each rhythm change, and the shape of the Bode plot (the resonance hump).
The s of the test signal we push with: this is what we choose. In frequency response we always push with a pure sine, so its s = jω and σ = 0.
So “σ = 0” is about the input, not about the system. It does not make the system critically damped (that is ζ = 1, a property of the system). Shake a lightly damped weight and a well damped one with the same pure sine: the input is the same, the Bode plots differ. Picture a car on a shaker table: the table moves in pure sines; the car's own shock absorbers decide how much the body bounces at each rhythm.
The key move of this step
In frequency response the input is a pure sine, and a pure sine has \sigma=0. That is why we always substitute:
s=j\omega\qquad\Longrightarrow\qquad G(j\omega)
G(j\omega) is one complex number for each rhythm \omega. Its length is the magnitude |G(j\omega)|, and its angle is the phase \angle G(j\omega). Then the steady-state output is:
Condition: the system is stable (its own poles have σ < 0, so their part dies out; otherwise there is no steady state).
Step B: a complex number as an arrow
A complex number z=a+jb is a point on a map: a steps to the right along the real axis (Re), b steps up along the imaginary axis (Im). Draw an arrow from zero to that point. Move a and b and watch the length and the angle:
a (Re)
b (Im)
map of a number z (Re to the right, Im up)
arrow zangle, measured from the +Re axisa and b (dashed)
The length is Pythagoras on the dashed triangle. The angle starts at the positive Re axis: arrow above it → positive angle, below it → negative angle. For a<0 the plain \arctan(b/a) lands in the wrong half; the explorer shows the correct angle (calculators call it atan2).
Try it yourself.z=-1+1j. Length and angle in degrees? (Check with the sliders.)
Length: Pythagoras with a = −1 and b = 1. Angle: the point is up and to the left, so between 90° and 180°.
|z|=\sqrt{1+1}=1.414. The point is 45° above the negative Re axis, so its angle is 180° − 45° = 135°.
Why we need a rule for fractions
Almost every G(s) is a fraction, like \dfrac{1}{1+j\omega}. The denominator 1+j\omega is easy to draw as an arrow. So we want to know: if I know the arrow z, what does the arrow 1/z look like? Two facts give the answer:
When you multiply two complex numbers, the lengths multiply and the angles add: |z_1z_2|=|z_1|\,|z_2|, \angle(z_1z_2)=\angle z_1+\angle z_2.
z\cdot\dfrac1z=1, and the number 1 is an arrow of length 1 and angle 0°.
So the lengths of z and 1/z must multiply to 1 and their angles must add to 0:
\left|\frac{1}{z}\right|=\frac{1}{|z|}\qquad \angle\frac{1}{z}=-\angle z
Check with numbers: z=1+j has length 1.414 and angle +45°. Its inverse \dfrac{1}{1+j}=0.5-0.5j has length 0.707 = 1/1.414 and angle −45°. Multiply: (1+j)(0.5-0.5j)=0.5-0.5j+0.5j+0.5=1. ✓
Example: a thermometer (1st-order system, T = 1 s)
A thermometer dipped into a cup reacts with a delay: after a temperature step it reaches 63 % after a time T. Its model and the substitution:
What is this example for? In part 1 you measured the magnitude and the phase (hand, weight, ruler). Here you calculate the same two numbers from the formula, with no experiment.
G(j\omega) is not a new “standard form”. It is the same G(s), just with s replaced by j\omega. You do the same with every G(s). For one rhythm ω you get one complex number, i.e. one arrow: its length = magnitude, its angle = phase.
What the thermometer does physically: the water in the cup heats up and cools down in turn, at rhythm ω. Slow changes: the thermometer keeps up and shows the full change. Fast changes: it can't keep up, it only averages, so the reading barely moves and is late.
How to read the slider below: the denominator 1+j\omega is an arrow “1 to the right” (fixed, from the “+1”) and “ω up” (set by the slider). At ω = 1 both steps are equal, so the arrow goes along the diagonal: 45°. Larger ω → the denominator arrow gets longer and steeper → G (its inverse) gets shorter and points further down: smaller magnitude, longer delay.
This map is not the pole map. On the s-plane (pole map) a pole on the right means an unstable system. Here we draw something else: the value of the number G(j\omega) (and of its denominator) for one rhythm ω. Same axes, different meaning: a point on the right here just means “positive real part of this number”. The thermometer is stable (its pole is at −1, on the left of the s-plane).
rhythm ω
Gray arrow: the denominator 1+j\omega (1 right, ω up). Blue arrow: G=1/(1+j\omega), the inverse: shorter and pointing down by the same angle.
map of the numbers 1 + jω and G(jω)
denominator 1 + jωG(jω) = 1/(1 + jω)
At \omega=1: the denominator has length \sqrt{1^2+1^2}=1.414 and angle 45°. So |G|=1/1.414=0.707 and \angle G=-45^\circ. In general:
The magnitude can range from 0.0001 to 1000. On an ordinary axis the small values merge with zero. That is why engineers write the magnitude in decibels (decibelios):
|G|_{dB}=20\log_{10}|G(j\omega)|
ratio |G|
dB
meaning
100
+40
100 times bigger
10
+20
10 times
2
+6
2 times
1
0
unchanged
0.707
−3
“corner”
0.5
−6
half
0.1
−20
10 times smaller
0.01
−40
100 times smaller
Two reasons:
Every “times 10” is simply “+20 dB”. Huge and tiny numbers fit on one axis.
Multiplying becomes adding. Two blocks one after the other multiply, G=G_1G_2. The log of a product is the sum of the logs, and angles add anyway:
|G_1G_2|_{dB}=|G_1|_{dB}+|G_2|_{dB}
\angle G_1G_2=\angle G_1+\angle G_2
So the Bode plot of the whole system = the sum of the curves of simple blocks (parts 5 and 6).
Converter
ratio = dB
dB = ratio
Decade (década) = ω times 10, one “numbered gridline” on the horizontal axis. A slope of “−20 dB/dec” means: when the rhythm grows 10 times, the magnitude shrinks 10 times.
Why 20 and not 10: the decibel for power is 10 log, and power grows with the square of the amplitude, so for amplitude it becomes 20 log. Definition from Franklin, ch. 6 (course bibliography); the FR-02 slides use dB without deriving it.
How to calculate decibels: examples
With a calculator: the log button is \log_{10}. Type the ratio, press log, multiply by 20.
Without a calculator: split the number into a product of numbers from the table. Multiplying ratios = adding dB (that is the whole trick of the logarithm).
Almost every G(s) can be split into a product of five kinds of simple blocks. Each block has an asymptote: an approximation with straight lines that is easy to draw by hand. Pick a block and turn its parameter. Blue line = exact curve, dashed orange = asymptote.
magnitude in dB
phase in degrees
exact curveasymptote (dashed)0 dB (dashed)
The asymptote rules and corner errors come from Franklin, ch. 6. There is no separate Bode deck in the slides (the guía docente treats it as a prerequisite).
Try it yourself. Pole \dfrac{1}{0.5s+1}. Where is the corner, and how many dB does the asymptote show at \omega=20 rad/s?
Corner = 1/T. Every decade (×10) past the corner the asymptote drops 20 dB.
Corner at 1/T=1/0.5=2. From the corner −20 dB/dec. ω = 20 is one decade past the corner (2 → 20), so −20 dB. Check in the block viewer: pole, T = 0.5.
6 · How to draw a Bode plot step by step
A recipe for paper, on the example G(s)=\dfrac{100}{s(s+10)} (a motor: voltage → shaft angle). Click “next”: each step adds one thing to the plot.
magnitude in dB
phase in degrees
K = 10integrator 1/spole, corner 10sum of asymptotesexact curve
Try it yourself.G(s)=\dfrac{1000}{(s+1)(s+100)}. Bring it to Bode form and give: the level to the left of the first corner (dB), the first corner, the slope between the corners and the slope after the second corner.
Pull a number out of each bracket so it looks like (Ts+1): (s+100) = 100·(0.01s+1). The numbers left in front give K. Every pole corner lowers the slope by 20.
K = 10 → 20 dB, flat (no integrator). Corners: 1 and 100. After the first corner −20 dB/dec, after the second −40 dB/dec. Check in the playground (part 8): K = 10, pole T₁ = 1, pole T₂ = 0.01.
7 · Bandwidth ↔ speed, hump ↔ overshoot
The Bode plot also tells how fast the system answers a step and whether it overshoots. Two definitions:
Bandwidth (ancho de banda, ω_BW)
the fastest rhythm the system can still follow: where the magnitude drops 3 dB below its level for slow rhythms (FR-06 p.10, Franklin figure 6.5). Headphones have a “frequency range” of 20 Hz–20 kHz: a heavy membrane cuts the high notes.
Resonance hump (cresta de resonancia, Mr)
how far the magnitude jumps above its starting level before it falls. This is the weight from part 1 at resonance. It appears when the damping ζ (zeta, “shock-absorber strength”) is small.
Why bandwidth = speed? A sharp step is a mix of all rhythms at once. A system with a narrow bandwidth cuts off the fast components, so the edge of the step gets rounded and the response is slow.
Comparison 1: a slow and a fast thermometer
Two thermometers: a thick one (T = 1 s) and a thin one (T = 0.2 s). Left: Bode, right: the response to a temperature step.
magnitude in dB
phase in degrees
step response
Bandwidth 5 times wider → response 5 times faster. For a 1st-order system \omega_{BW}=1/T and t_s(5\%)=3T, so t_s=3/\omega_{BW}.
Comparison 2: three shock absorbers
The same spring and mass (\omega_n=5 rad/s, its own rhythm), three shock absorbers: weak ζ = 0.1, medium ζ = 0.4, good ζ = 0.7.
magnitude in dB
phase in degrees
step response
Weak shock absorber: a high hump on the Bode plot and a lot of wobble after the step (overshoot Mp, sobreoscilación). The same lack of braking seen from two sides, so the hump and Mp grow together.
Table from 2nd-order formulas. The last column is needed in part 9 (the phase margin of the loop that closes into this system, FR-02 p.13). For 2nd order the rise time is t_r\approx1.8/\omega_n (Franklin, ch. 3, outside the slides).
Try it yourself. A 1st-order sensor has a bandwidth of 4 rad/s. What are its T and its settling time t_s (5 %)?
1st order: ω_BW = 1/T and t_s = 3T.
T=1/\omega_{BW}=0.25 s, t_s=3T=0.75 s.
8 · Playground: building a Bode plot from blocks
Now everything at once. Switch blocks on, turn the parameters, compare the exact curve with the asymptotes and watch the step next to it. The buttons at the top load ready-made systems.
K
−20 dB/dec, −90°
pair ζ
magnitude in dB
phase in degrees
step response of the same G
exactasymptotes (dashed)bandwidth ω_BW0 dB, final value (dashed)
A zero alone without a pole: the Bode plot can be drawn, a step cannot (numerator of higher degree than the denominator, such a system does not exist physically).
9 · Margins: the Bode plot of the loop function L(jω)
The loop in two sentences. In a control loop the signal goes round: controller D → plant G → sensor H → back to the summing junction, which subtracts the measurement from the target. One trip round is the loop function (función de lazo) L=D\,G\,H, and the closed-loop poles lie where 1+L(s)=0.
The stability boundary means poles on the imaginary axis, i.e. exactly s=j\omega. Then 1+L(j\omega)=0, so L(j\omega)=-1. The number −1 as an arrow has length 1 and angle −180°:
Microphone next to a loudspeaker. Sound goes round: microphone → amplifier → speaker → air → microphone. If for some tone the trip flips it by 180° (and the summing junction adds its own minus, together a full 360°, so the tone comes back “in phase”) and does not quiet it (magnitude ≥ 1), the tone gets louder each round: a squeal. The margins say how far you are from the squeal:
Gain margin, MG
(margen de ganancia, FR-02 p.4) Find the rhythm \omega_f where the phase = −180° (frecuencia de cruce de fase). Read the magnitude there. MG = how many dB are missing to 0 dB. “How much more you can turn up the volume knob.”
|L(j\omega_f)|_{dB}+MG=0
Phase margin, MF
(margen de fase, FR-02 p.5) Find the rhythm \omega_g where the magnitude = 0 dB (frecuencia de cruce de ganancia). Read the phase there. MF = how many degrees are missing to −180°. “How much extra delay it tolerates.”
\angle L(j\omega_g)-MF=-180^\circ
Try it yourself. On a loop Bode plot: at \omega_g (magnitude 0 dB) the phase is −140°. At \omega_f (phase −180°) the magnitude is −8 dB. Give MF and MG.
MF = 180° + (phase at ωg). MG = minus (magnitude in dB at ωf).
MF: −140° − MF = −180° → MF = 40°. MG: −8 dB + MG = 0 → MG = 8 dB (the gain can go up 2.5 times, since 10^(8/20) = 2.5). Both positive, so the loop is stable.
Stable loop ⇔ MG > 0 and MF > 0, and then \omega_g<\omega_f (FR-02 p.6–7). Condition: L minimum phase (fase mínima): all poles and zeros on the left, at most one pole at zero.
MF tells the damping:\zeta\approx MF/100 for 0° < MF < 60° (FR-02 p.12). Smaller MF → more overshoot and a larger closed-loop hump (FR-02 p.11, FR-06 p.12).
ωg tells the speed: closed-loop bandwidth \omega_g\le\omega_{ab}<2\omega_g (FR-02 p.12).
The left end of |L| tells the steady-state error: flat → an error remains, e_p=1/(1+L(0)); slope −20 dB/dec (integrator in the loop) → e_p=0 (FR-02 p.3).
Lab: controller gain and margins
A P controller is block K: it shifts only the magnitude curve up, the phase stays put. Watch ωg run to the right, MF shrink, and the closed-loop poles move to the right. The orange markers under the slider are the gains where the verdict changes (MF = 30°, the stability edge): click one, then nudge the slider around it.
gain
|L(jω)| in dB
∠L(jω) in degrees
closed-loop step, target r = 1
closed-loop poles (s-plane: right of the Im axis = unstable)
L(jω)MG (segment at ωf)MF (segment at ωg)0 dB and −180° (dashed)|T(jω)|
Things to check: oven FR-03 p.7: D = 10 gives MG = 0 dB and MF = 0°, poles on the Im axis (the same comes out of 1 + L = 0). Robot arm: Kp = 2.55 → MF ≈ 65°, the rule gives ζ ≈ 0.65, the true ζ = 0.70. The arm without a filter has MG = ∞ (the phase never reaches −180°), so P alone cannot destabilize it. A 0.05 s sensor filter pulls the phase down and turns it into a limit Kp = 15.
Guide: exactly where to look to read PM and GM
The motor from the practical exam (L = K·500/(s(s+500))) and the oven from FR-03 p. 7. Green = phase margin MF (margen de fase), red = gain margin MG (margen de ganancia). Under the Bode plot a small step response shows what the numbers mean in time.
Plant
K
Top: |L| (magnitud). Bottom: ∠L (fase). Thick blue = selected K, thin grey = the other K values (the phase is the same for every K).
Wcp (|L| = 0 dB)
MF = Pm
Wcg (phase = −180°)
MG = Gm
K max
Link: closed-loop step response for this K
Small MF = big overshoot. MG < 0 = the curve leaves the plot. Dashed = final value.
Special cases (click “Show”)
What you see
What it means
The magnitude never crosses 0 dB
Wcp does not exist → MF = ∞
The phase never crosses −180°
Wcg does not exist → MG = ∞, stable for every K
At −180° the magnitude is exactly 0 dB
MG = 0 dB, MF = 0° → the edge
At −180° the magnitude is ABOVE 0 dB
MG < 0 dB → unstable
MATLAB: margin(L) draws the same, with Gm and Pm in the title. [Gm,Pm,Wcg,Wcp] = margin(L) gives the numbers (Gm as a ratio, mag2db(Gm) in dB). Several K at once: bode(50*G,125*G,1000*G).
10 · Five applications side by side
Plants alone (no loop), Bode and step on shared axes. The buttons under the table switch systems on and off. The motor (an integrator) keeps rising forever after a step, so its ramp leaves the step plot at the top instead of squashing the other curves.
magnitude in dB
phase in degrees
step response
Quiz on the five applications
11 · Traps
dB vs ratio. −6 dB is “half”, not “minus six times”. MATLAB margin returns Gm as a ratio: MG_{dB}=20\log_{10}G_m.
rad/s vs Hz.\omega=2\pi f. MATLAB's Bode uses rad/s by default. A “1 Hz” suspension is 6.28 rad/s on the plot.
Degrees vs radians. The Bode phase is in degrees, but atan in MATLAB returns radians: use atand or multiply by 180/π.
L vs T. You read margins on the Bode plot of the open loop L. You read bandwidth and the hump on the closed loop T = L/(1+L). They are different curves: |T| ≈ 1 below ωg, |T| ≈ |L| above (FR-02 p.9–16).
The asymptote is not the curve. At a pole's corner the true curve lies 3 dB lower. At ωn of a pair: -20\log_{10}(2\zeta) relative to the asymptote, i.e. +14 dB for ζ = 0.1.
Phase wrapping. −270° and +90° are the same angle. MATLAB sometimes draws a 360° phase jump. When looking for −180°, follow the continuity of the curve or set PhaseWrapping to 'off'.
Margins on L = D·G·H, not on G. The controller and the sensor belong to the loop. A good MF of G alone says nothing if D = 50.
Only for minimum-phase L (FR-02 p.6). A pole or zero on the right (e.g. FR-03 p.8, 1/(s-1)): MG/MF give nonsense, check 1+L=0.
MATLAB names are the other way round from the slides.Wcg = where MG is measured (phase −180°, on the slides \omega_f). Wcp = where MF is measured (magnitude 0 dB, on the slides \omega_g). Franklin (FR-06 p.12) writes \omega_c instead of \omega_g.
12 · MATLAB
%% Step 5: Bode and margins
s = tf('s');
G = 1/(s+1); % thermometer, T = 1 s
bode(G), grid on % magnitude in dB (top), phase in degrees (bottom), ω in rad/s
[mag,phase,w] = bode(G); % numbers instead of a picture
magdB = 20*log10(squeeze(mag)); % squeeze: bode returns a 1x1xN array
opts = bodeoptions;
opts.FreqUnits = 'Hz'; % axis in Hz instead of rad/s
opts.PhaseWrapping = 'off';
bode(G, opts), grid on
%% Margins on the loop function L = D*G*H (FR-03 p.7)
D = 5;
Gp = 6/((s+1)*(s+2)*(s+3));
L = D*Gp;
figure, margin(L) % Bode + MG, MF and frequencies in the title
[Gm,Pm,Wcg,Wcp] = margin(L) % Gm is a RATIO; Wcg = ωf, Wcp = ωg
GmdB = 20*log10(Gm)
%% Closed loop: bandwidth and step
T = feedback(L,1);
bandwidth(T) % ωab in rad/s (−3 dB below T(0))
figure, bode(L, T), grid on, legend('L','T')
figure, step(T), grid on
linearSystemAnalyzer(L) % in older versions: ltiview(L)
Reading the plot: click the curve = data tip with ω, dB and degrees. Right click → Characteristics → All Stability Margins / Peak Response. Right click → Properties → Units: rad/s or Hz.
Result to compare with the lab in part 9: D = 5 → MG = 6.0 dB (Gm = 2.0) at Wcg = 3.32 rad/s, MF = 25.4° at Wcp = 2.35 rad/s.
13 · Check yourself
Z1. Decibels. How many dB is an amplitude ratio of 5? What ratio is −40 dB?
20·log10 of the ratio; for −40 dB use 10^(−40/20).
At ω = 1 only K and the integrator count: 20 + 0 = 20 dB. Corner 1/0.01 = 100. Up to the corner −20 dB/dec, after it −40 dB/dec. The same recipe as in part 6.
Z4. The hump. 2nd-order pair with \omega_n=5, \zeta=0.1. How high is the hump (dB above 0) and at what ω?
The gain can go up 10 times: D_max = 10 (FR-03 p.7). Where √11 comes from: expand the denominator, (j\omega)^3+6(j\omega)^2+11j\omega+6; phase −180° ⇔ imaginary part = 0 ⇔ -\omega^3+11\omega=0.
Z6. MF → ζ → Mp. The loop has MF = 45°. Estimate ζ of the closed loop and its overshoot in %.
That was the last review step. Next comes the Fundamentos de Realimentación block: sensitivity and robust margins (FR-03), steady-state error (FR-04), disturbances (FR-05), specifications (FR-06).
Sources: FR-02 p.2–16 (Bode of L, MG, MF, ζ ≈ MF/100, ωg ≤ ωab < 2ωg, L vs T), FR-06 p.10, 12, 16 (Bode specifications, Franklin figures), FR-03 p.7–10 (oven, unstable plant, distance from −1 = 1/|S|), SS-07 p.14 (sine → steady state), SS-04 p.12 (Laplace transform of a sine), SS-10 (Mp). Outside the slides (Franklin, Feedback Control of Dynamic Systems, ch. 3 and 6, course bibliography): asymptote rules, formulas for Mr, ωr, ω_BW, t_r ≈ 1.8/ωn, the dB definition.