Always free. For everyone.
Course outline
Module 10 of 20 · Classical control

Design in the frequency domain

Read Bode plots, reason about Nyquist, and add phase lead. This module has 3 lessons and takes about 2h 25m. Each lesson has a practice exercise that runs real Python in your browser and a short quiz.

Start module 10 in the Learning Lab
LESSON 1 OF 3

Frequency response and Bode plots

35 minControl engineering
WHAT YOU WILL DO

Calculate magnitude and phase at a chosen frequency.

For a stable linear system driven by sin(omega*t), the long-term output is a sinusoid at the same frequency with changed amplitude and phase. Substitute s=j*omega into G(s) to get the complex frequency response.

Magnitude in decibels is 20*log10(abs(G)). Phase is the complex angle in degrees. A first order low-pass 1/(tau*s+1) has magnitude 1/sqrt(1+(omega*tau)^2) and phase -atan(omega*tau).

At omega=1/tau, magnitude is about -3.01 dB and phase is -45 degrees. At high frequencies the asymptotic slope is -20 dB per decade. Keep rad/s and Hz separate using omega=2*pi*f.

See it in action

example.pyPython 3
import numpy as np
tau, omega = 2., 0.5
response = 1/(1+1j*omega*tau)
print('Magnitude (dB):',20*np.log10(abs(response)))
print('Phase (degrees):',np.angle(response,deg=True))
Keep this in mind

Frequency plots reveal how gain and phase depend on time scale.

LESSON 2 OF 3

Margins, Nyquist, and delay

35 minControl engineering
WHAT YOU WILL DO

Calculate phase margin and understand its limits.

Gain crossover occurs where abs(L(jw))=1. Phase margin is 180 degrees plus the loop phase there, using the phase branch near -180 degrees. Gain margin measures how much loop gain can increase before a -180-degree crossing reaches unit magnitude.

Nyquist relates encirclements of -1 to closed-loop unstable poles. With N defined as net clockwise encirclements and P as open-loop right-half-plane poles, Z=N+P counts closed-loop right-half-plane poles. Open-loop imaginary-axis poles require an indented contour.

For L=K/(s+1)^2 with K>1, crossover is sqrt(K-1) and phase is -2*atan(w). For K=2, w=1 and phase margin is 90 degrees. A delay adds phase -w*T radians. The estimate T=PM_radians/w uses the same crossover and is not a universal margin for multiple crossings.

See it in action

example.pyPython 3
import math
gain = 2.
wc = math.sqrt(gain-1)
phase = -2*math.degrees(math.atan(wc))
pm = 180+phase
delay_estimate = math.radians(pm)/wc
print('wc:',wc,'PM:',pm,'Delay estimate:',delay_estimate)
Keep this in mind

Margins support a stability argument but do not replace its assumptions.

LESSON 3 OF 3

Practical: add phase lead

75 minControl engineering
WHAT YOU WILL DO

Design a lead compensator at a target crossover and verify the result.

A lead network C(s)=Kc*(1+T*s)/(1+alpha*T*s), with 0<alpha<1, adds positive phase. Maximum phase lead is asin((1-alpha)/(1+alpha)). It occurs at omega_m=1/(T*sqrt(alpha)).

Choose alpha=1/3 and omega_m=2 rad/s. This gives 30 degrees maximum lead. Set T=1/(2*sqrt(alpha)). For P=1/(s+1)^2, choose Kc so abs(C(j2)*P(j2))=1.

The lead also increases high-frequency gain, which can amplify measurement noise. Verify the full Bode plot and closed-loop poles, then compare the step response and command effort with a proportional design at the same crossover.

GUIDED PRACTICAL · 75 MIN

Your experiment plan

Use the browser editor or the downloadable notebook. All plant data are simulated. Keep a notebook with parameters, predictions, results, and units.

  1. Plot plant, proportional loop, and lead-compensated loop Bode responses.
  2. Mark target crossover and measure the actual phase margin.
  3. Build the closed-loop numerator and denominator and check all poles.
  4. Compare time response and high-frequency gain with the proportional design.

What to hand in

  • A Bode plot with crossover and margin annotations.
  • Compensator parameters and closed-loop poles.
  • A short performance-versus-noise discussion.
Reflect on your results

Which assumption matters most? Describe one result that surprised you and one experiment that would test your explanation.

The automatic exercise checks the core code behaviour. Review observations and written deliverables yourself or with a mentor.

See it in action

example.pyPython 3
import numpy as np
alpha, wc = 1/3, 2.
T = 1/(wc*np.sqrt(alpha))
p = 1/(1+1j*wc)**2
lead = (1+1j*wc*T)/(1+1j*wc*alpha*T)
kc = 1/abs(p*lead)
loop = kc*lead*p
print('T:',T,'Kc:',kc,'PM:',180+np.angle(loop,deg=True))
Keep this in mind

Check the entire loop after a local frequency design.

ABOUT THE LEARNING LAB

Free, open and run by a nonprofit.

This page is part of Control Engineering, a free course of 20 modules and 60 lessons in the engineering.fit( ) Learning Lab. The Learning Lab is built and run by engineering.fit( ), a nonprofit founded by Abdullateef Opeyemi Bakare that helps African engineering students gain research experience. You do not need an account or pay a fee to learn.

Course outline · Project lab · Visit engineering-fit.org