RobotGuide

Math foundations · topic A5 · 30 hours

Signals & systems (frequency domain / filtering)

Reading a Bode plot is the one universal way to judge whether a servo system is any good. Cutoff frequency, phase margin, resonance peak — these words come up daily at the tuning bench.

Foundations stage · Hardcore
Algorithm · Hands-on System software · Hands-on Embedded & controls · Proficient Mechanical · Aware

Tools
Tools

What to learn

  • Transfer functions and Bode plots: what gain margin, phase margin, and the resonance peak each tell you
  • First- and second-order filter design, and the phase lag they bring (lag is delay)
  • The sampling theorem and aliasing: why insufficient encoder sampling shows up as «high-frequency jitter»
  • The implementation difference between IIR and FIR, and why control loops should be wary of high-order IIR
  • Estimate a concrete loop: adding two stages of 100 Hz low-pass — how much phase is lost at 1 kHz

The lesson · plain words

A sensor never hands you the truth — it hands you a cocktail of «truth + delay + noise». Signals and systems teaches you two things: take the cocktail apart (frequency-domain analysis), and while taking it apart, do not pour out the useful parts too (filter design).

Four concepts on this page: the frequency domain, filters, sampling, and phase delay — together they are the base vocabulary for diagnosing every «jitter, oscillation, sluggishness» in a control loop.

The frequency domain: taking a song apart into single piano keys

Fourier's insight: any signal can be decomposed into a stack of sine waves. The plot of «how much each frequency contributes» is the spectrum. You can do this natively: hear a C+E+G chord and pick out the three notes directly — the human ear is a Fourier transformer.

The robot version: motor vibration is a high-frequency spike on the spectrum, thermal drift is a low-frequency gentle slope — they sit at opposite ends, so you can handle them separately. The frequency domain is not abstract mathematics; it is «sorting troubles of different time scales into different bins».

The low-pass filter: sharp and steady do not come together

The simplest low-pass filter = the moving average: average the last N readings and the spikes get flattened. The key parameter is the cutoff frequency — «how fast a change is allowed to pass through». Turn the cutoff down: silky-smooth curves, but the price is lag — real changes also show up several beats late.

A number to feel the cost: 10 Hz sampling with a 5-point average gives a delay of about 2 sampling periods = 0.4 s. Irrelevant for temperature monitoring, a disaster for a 1 kHz control loop. Every «smoother» a filter offers is bought with «slower to react».

Interactive figure · drag it and see

What this figure shows: the raw signal (gray) against its N-point moving average (orange), with a window-size control; the readout shows latency ≈ (N−1)/2 samples, which grows as you widen the window. Takeaway: spikes flatten, but real changes arrive late — sharpness and stability trade off, so pick the window from the loop's latency budget, not from aesthetics.

Sampling: the science of shutter speed

The continuous world must be sampled to enter a computer. The Nyquist theorem: the sampling rate must be at least 2× the signal's highest frequency, otherwise high frequencies «disguise themselves» as low ones — aliasing. You have seen it in videos: wheels appearing to spin backward, fans seeming to turn slowly — aliasing in the wild.

The countermeasure: always put an analog anti-aliasing filter before the ADC, physically blocking everything above half the sampling rate — this stage cannot be patched digitally afterward; it is a mandatory hardware item.

Interactive figure · drag it and see

What this figure shows: a true 3 Hz sine (gray) with its sample points (orange dots) and the wave the digital side reconstructs (purple); a slider changes the sampling rate against the Nyquist line at 6 Hz, and the readout shows the frequency the alias appears at — at high rates, what you see is what it is. Takeaway: sample below 2× the highest frequency and the fake low-frequency component becomes indistinguishable from a real one — block it with an analog filter before sampling, never after.

Phase = delay, delay = instability

Every filter order adds phase lag, and in a control loop 90° of phase lag turns «damping» into «excitation» — that is the mathematical root of «the harder you filter, the more easily the system oscillates». So filter design is never a signals-course homework problem; it is a life-or-death question in control.

The engineer's checkup tool is the Bode plot (the one at the top of this page): see how many degrees of phase margin remain — 45° is a common engineering line: below it the system oscillates; far above it the response turns sluggish.

Three questions — do you really get it?

1. In a video, wheels appear to spin backward — which phenomenon is this?

  • ASaturation
  • BQuantization error
  • CAliasing
Show answer

C. The sampling rate cannot keep up with the spoke frequency, and high frequencies «disguise themselves» as low ones — Nyquist violated, in daily life.

2. You turn the low-pass filter's cutoff frequency down. The price?

  • ALarger delay (lag)
  • BMore expensive
  • CMore noise
Show answer

A. Smooth and responsive are antonyms: smoother = even real changes show up several beats late.

3. Why must the anti-aliasing filter sit before the ADC (an analog one)?

  • AOnce aliasing happens, the digital side cannot tell real from fake
  • BAnalog ones are cheaper
  • CTraditional habit
Show answer

A. After aliasing folds high frequencies down into low ones, the digital side can no longer tell «true low frequency» from «fake low frequency» — it must be blocked physically before sampling.

Keep going deeper

Links without a marker stay on this site; the rest point to the Chinese edition until its translation batch lands.

How it fails in the field

  • Piling on low-pass filters in the name of «clean signals», eating up the phase margin — the system becomes more prone to oscillation, not less
  • Assuming 10× the signal frequency is enough sampling rate, while the arithmetic shows aliasing has already entered the control bandwidth

You have learned enough when

You can sketch the Bode plot of a second-order system and read out its bandwidth and phase margin, explain why raising the gain makes the system oscillate, and design a first-order low-pass while stating the phase lag it introduces.

The Chinese edition carries the full topic page for Signals & systems (frequency domain / filtering), including the complete outline, depth requirements per career track, and further derivations: robotguide.dev/k/A5/.