Appearance
Second-Order Filter
Second-order low-pass, high-pass, band-pass or notch filter with natural frequency f0, damping ratio ζ and gain K. Discretized with the bilinear (Tustin) transform prewarped at f0, so the corner sits exactly at f0 and lightly damped filters stay stable at any time step. f0 must be below half the sample rate (1/(2·Δt)); a higher value is pulled just below it with a logged error. The filter starts in steady state for its first input.
Category: Continuous
Overview
The Second-Order Filter is a configurable biquad: one block that can be a low-pass, high-pass, band-pass or notch filter. You set the natural frequency
Typical uses:
- Low-pass: anti-aliasing ahead of a sampled controller, or smoothing a measured quantity.
- Notch: removing a known ripple from a measurement, such as the 100 / 120 Hz ripple on a single-phase power signal or the 2nd harmonic on a DC link.
- Band-pass: pulling out one frequency, for example to track an oscillation mode.
Transfer functions
All four types share the denominator
| Type | Gain at DC | Gain at | Gain at high frequency | |
|---|---|---|---|---|
| Low-pass | 0 | |||
| High-pass | 0 | |||
| Band-pass | 0 | 0 | ||
| Notch | 0 |
For a low-pass or high-pass,
Discretization
This block is the one exception to the forward-Euler rule of the control domain (see Chapter 17). Forward Euler on a lightly damped second-order section is stable only when
The bilinear transform is stable at any time step. Prewarping makes the discrete response equal the continuous one exactly at
The coefficients are computed once, on the first step. The filter then runs as a direct-form-II-transposed biquad with two state values.
Limits and start-up
must lie below half the sample rate, . A higher value is pulled to just below that limit, with an error in the run log. - A negative
would be unstable, so its magnitude is used, with an error in the run log. - The filter starts in steady state for its first input. Feed it a constant and the output is that constant times the DC gain from the first sample:
for a low-pass or notch, 0 for a high-pass or band-pass. There is no start-up transient.
Related
- Lead-Lag / Washout: first-order lead, lag and washout
- Transfer Function (1st Order): first-order lag with dead time
- RMS Meter: measures the size of what the filter passes
Ports
| Port | Kind | Signal | Notes |
|---|---|---|---|
in | Control input | Real | |
out | Control output | Real |
Parameters
| Parameter | Type | Default | Units | Description | ID |
|---|---|---|---|---|---|
| Type | Choice: Low-pass / High-pass / Band-pass / Notch | Low-pass | — | Low-pass = Kω0²/D(s). High-pass = Ks²/D(s). Band-pass = K·2ζω0·s/D(s), gain K at f0. Notch = K(s²+ω0²)/D(s). D(s) = s² + 2ζω0·s + ω0². | type |
| f0 | Number | 50 | Hz (also rad/s) | Natural (corner or centre) frequency. Must be below half the sample rate. | f0 |
| ζ | Number | 0.707 | — | Damping ratio. 0.707 gives a maximally flat low-pass; smaller values give a resonant peak (low-pass, high-pass) or a narrower band (band-pass, notch). | zeta |
| K | Number | 1 | — | Gain in the passband. | K |