Sunday, May 31, 2026

bode plot of a magnetic levitator

 Magnetic levitation is one of the classic teaching plants in control because of what its Bode plot reveals, so this is a fun one. Let me lay out where the plot comes from, then show it.

The plant is open-loop unstable

An electromagnet holds a steel ball at gap π‘₯ below it. The attractive force grows as the ball gets *closer*, which is positive feedback — exactly what makes the thing want to either slam up or fall away. The force model is 𝐹=π‘˜(𝑖/π‘₯)2, and the ball obeys

π‘šπ‘₯¨=π‘šπ‘”π‘˜π‘–2π‘₯2.

Linearizing about the hovering equilibrium (π‘₯0,𝑖0) where π‘šπ‘”=π‘˜π‘–02/π‘₯02 gives

Δ𝑋(𝑠)Δ𝐼(𝑠)=𝐾𝑖/π‘šπ‘ 2π‘Ž2,π‘Ž=2𝑔π‘₯0..

That 𝑠2π‘Ž2 in the denominator factors into (π‘ π‘Ž)(𝑠+π‘Ž): one pole in the right half-plane at +π‘Ž (the instability) and one in the left half-plane at π‘Ž. With a 1 cm gap, π‘Ž=29.81/0.0144 rad/s ( 7 Hz) — notice it depends only on the gap, not the mass or current. (A real coil adds one more stable pole at 𝑅/𝐿 from its 𝐿𝑑𝑖/𝑑𝑑 dynamics, steepening the high-frequency rolloff, but the interesting behavior lives in the mechanical pair.)

Let me load the plotting setup and draw it.










Reading the plot

The striking thing — and the whole reason maglev is a teaching favorite — is that the maglev's magnitude curve is *identical* to that of a perfectly stable system with a double pole at π‘Ž. Both sit flat at the DC gain, both break at πœ”=π‘Ž, both roll off at 40 dB/decade with no resonant peak (the denominator πœ”2π‘Ž2 never gets small, so nothing rings).

The phase is where they diverge completely. The stable look-alike sweeps the familiar 0°180°, passing 90° at the corner. The maglev's phase stays **flat**. That happens because the right-half-plane pole contributes +90° of phase *lead* across the band, exactly canceling the left-half-plane pole's 90° of lag. (Depending on the sign convention from the linearization you'll see it pinned at 0° or at ±180°, but the point is it doesn't move.)

That frozen phase, decoupled from the magnitude rolloff, is the fingerprint of the RHP pole. It also breaks Bode's gain–phase relationship, which holds only for minimum-phase systems — which is precisely why you cannot read the maglev's instability off the magnitude plot at all. Two plants, same gain curve, opposite stability.

Why it matters for control

Because the open-loop plant has a pole in the right half-plane, the usual shortcut of reading gain and phase margins off the open-loop Bode plot doesn't tell you whether the closed loop is stable. You fall back to the full Nyquist criterion, 𝑍=𝑁+𝑃 with 𝑃=1: the Nyquist contour has to encircle 1 once counterclockwise just to *reach* stability, rather than avoid encirclement. In practice you wrap a lead or PD/PID compensator around the plant, adding phase lead near the crossover to pull that RHP pole into the left half-plane and let the ball actually hover.

Drag the air-gap slider and you'll see the only thing that moves is the pole frequency π‘Ž=2𝑔/π‘₯0 — a smaller gap pushes the unstable pole higher, meaning faster divergence and a harder, faster controller requirement.


Here's the Nyquist locus of the open-loop maglev. I've kept the coil's electrical pole in the model (the R/L-R/L term from before) so the plot is a proper curve rather than the degenerate line segment the idealized second-order plant gives — more on that below.



Reading the plot

The whole locus lives in the right half-plane — every point has positive real part. You can prove it directly: L(jΟ‰)=K(pjΟ‰)(Ο‰2+a2)(p2+Ο‰2)L(j\omega) = \dfrac{K\,(p - j\omega)}{(\omega^2 + a^2)(p^2 + \omega^2)} , and the real part Kp(Ο‰2+a2)(p2+Ο‰2)\dfrac{Kp}{(\omega^2+a^2)(p^2+\omega^2)} is strictly positive for all Ο‰\omega . So the curve is a teardrop pinned to the origin at Ο‰=±\omega = \pm\infty , bulging out to the loop gain on the positive real axis at Ο‰=0\omega = 0 . It traverses clockwise as Ο‰\omega runs from -\infty to ++\infty .

Now apply the criterion. The plant has P=1P = 1 pole in the right half-plane, so for a stable closed loop the locus must encircle the 1-1 point **once counterclockwise** (Z=N+P=0Z = N + P = 0 requires N=1N = -1 ). But 1-1 sits on the *negative* real axis, and the locus never crosses to that side at all. So N=0N = 0 , giving Z=N+P=1Z = N + P = 1 : one unstable closed-loop pole. The ball won't hover under simple feedback.

Drag the gain slider and watch what it can't do. More gain just stretches the teardrop further out along the *positive* real axis — away from 1-1 , never around it. Less gain shrinks it toward the origin. No proportional gain, of either sign, ever delivers the encirclement, which is the Nyquist-domain statement of what the flat phase curve told us earlier: this is a non-minimum-phase plant and the magnitude/gain knob alone is powerless.

To stabilize it you need something that bends the locus into the left half-plane near the critical point — phase lead. A PD or lead compensator rotates the high-frequency tail counterclockwise so the curve sweeps around 1-1 and supplies the missing encirclement.

(For the idealized second-order plant from the Bode discussion, with no coil pole, the same algebra collapses the teardrop onto the bare positive-real-axis segment from K/a2K/a^2 back to 00 — same conclusion, just flattened.)

No comments:

Post a Comment