Library / Signal processing and digital filters / DSP-36
Signal processing and digital filters
One output step of a normalised biquad
Next output of a second-order IIR section with denominator 1 + a1z⁻¹ + a2z⁻² (divide all coefficients by a0 first if a0 ≠ 1).
- Ref
- DSP-36
- Rev
- v1
- Field
- Signal processing and digital filters
- Result
- y[n] [V]
A second-order recursive section computes y[n] = b₀x[n] + b₁x[n − 1] + b₂x[n − 2] − a₁y[n − 1] − a₂y[n − 2]. The feed-forward part uses the latest inputs and the feedback part uses the previous outputs, with the denominator normalised to 1 + a₁z⁻¹ + a₂z⁻². If a₀ is not 1, divide every coefficient by it first.
Next output of a second-order IIR section with denominator 1 + a1z⁻¹ + a2z⁻² (divide all coefficients by a0 first if a0 ≠ 1). The inputs are the three newest input samples (newest first, slots 0 to 2) and the previous two outputs (newest first).
Calculator
- Feed-forward part, b₀x[n] + b₁x[n − 1] + b₂x[n − 2]0.4 V
- Feedback part, a₁y[n − 1] + a₂y[n − 2]−0.36 V
- Stability margin of the denominator0.6
What drives the result
Each variable is moved across its typical range while the others stay at the values above. The longest bar is the key driver.
- The next output is 0.76 V: 0.4 V from the inputs and 0.36 V from the fed-back outputs.
- The denominator is stable, so the fed-back part dies away if the input stops.
Chart data as tables
Ranked variables
| Variable | Typical range | Lowest result | Highest result | Swing (V) | Local step | Change in result |
|---|---|---|---|---|---|---|
| y[n-1] Previous output | −10 to 10 V | −4.64 | 5.36 | 10 | +0.4 V | +26.3 % |
| b1 Numerator coefficient b₁ | −2 to 2 | −3.44 | 4.56 | 8 | +0.08 | +21.1 % |
| b0 Numerator coefficient b₀ | −2 to 2 | −1.44 | 2.56 | 4 | +0.08 | +10.5 % |
| x[n] Current input | −10 to 10 V | −1.44 | 2.56 | 4 | +0.4 V | +10.5 % |
| a1 Denominator coefficient a₁ | −2 to 2 | −1.24 | 1.96 | 3.2 | +0.08 | −8.42 % |
| x[n-1] Previous input | −10 to 10 V | −0.44 | 1.56 | 2 | +0.4 V | +5.26 % |
| y[n-2] Output two samples back | −10 to 10 V | −0.2 | 1.8 | 2 | +0.4 V | −5.26 % |
| x[n-2] Input two samples back | −10 to 10 V | −0.24 | 1.76 | 2 | +0.4 V | +5.26 % |
| a2 Denominator coefficient a₂ | −1 to 1 | 0.4 | 1.2 | 0.8 | +0.04 | −2.11 % |
| b2 Numerator coefficient b₂ | −2 to 2 | 0.76 | 0.76 | 0 | +0.08 | 0 % |
Sweep of Current input
| Current input (V) | Output sample (V) |
|---|---|
| −10 | −1.44 |
| −7.5 | −0.94 |
| −5 | −0.44 |
| −2.5 | 0.06 |
| 0 | 0.56 |
| 2.5 | 1.06 |
| 5 | 1.56 |
| 7.5 | 2.06 |
| 10 | 2.56 |
Sweep one variable
Variables and how each one contributes
Output sample
What the equation gives you. Everything else feeds it.
Numerator coefficient b₀
The numerator coefficient for the current input. Scales the effect of the newest input sample directly. Raising it by 10 % (to 0.22) moves the result by +2.63 %, from 0.76 to 0.78 V.
Numerator coefficient b₁
The numerator coefficient for the previous input. Weights x[n − 1] in the output. Raising it by 10 % (to 0.11) moves the result by +2.63 %, from 0.76 to 0.78 V.
Numerator coefficient b₂
The numerator coefficient for the input two samples back. Weights x[n − 2] in the output. Raising it by 10 % (to 0.11) moves the result by +0 %, from 0.76 to 0.76 V.
Current input
The current input x[n], in V. Enters through b₀. Raising it by 10 % (to 1.1) moves the result by +2.63 %, from 0.76 to 0.78 V.
Previous input
The previous input x[n − 1], in V. Enters through b₁. Raising it by 10 % (to 2.2) moves the result by +2.63 %, from 0.76 to 0.78 V.
Input two samples back
The input x[n − 2], in V. Enters through b₂. Raising it by 10 % (to 0) moves the result by +0 %, from 0.76 to 0.76 V.
Denominator coefficient a₁
The first denominator coefficient. Feeds back the previous output with the opposite sign; it sets the pole angle together with a₂. Raising it by 10 % (to −0.55) moves the result by +5.26 %, from 0.76 to 0.8 V.
Denominator coefficient a₂
The second denominator coefficient. Feeds back the output from two samples ago; it sets the pole radius squared. Raising it by 10 % (to 0.11) moves the result by −0.526 %, from 0.76 to 0.756 V.
Previous output
The previous output y[n − 1], in V. Is fed back through −a₁. Raising it by 10 % (to 0.88) moves the result by +5.26 %, from 0.76 to 0.8 V.
Output two samples back
The output y[n − 2], in V. Is fed back through −a₂. Raising it by 10 % (to 0.44) moves the result by −0.526 %, from 0.76 to 0.756 V.
Worked example with the values above
- Feed-forward: 0.2 × 1 + 0.1 × 2 + 0.1 × 0 = 0.4 V.
- Feedback: −0.5 × 0.8 + 0.1 × 0.4 = −0.36 V.
- y[n] = 0.4 − (−0.36) = 0.76 V.
Assumptions and limits
- A real, linear, time-invariant second-order section with the leading denominator coefficient normalised to one.
- Exact arithmetic; fixed-point overflow and round-off noise are not included.
Common mistakes
- Using the unnormalised a₀ ≠ 1 coefficients without dividing through.
- Taking the pole angle as the frequency of peak gain.
- Treating a stability margin close to zero as safe in finite precision.
Statistics and uncertainty
Coefficient quantisation moves poles: in fixed point or single precision, poles close to the unit circle (r above about 0.999) can drift to instability, so check the margin with the rounded coefficients.
Where it is used
- Checking and designing recursive filters such as notches and resonators.
- Estimating ringing time and oscillation frequency from pole locations.
Maths you need
- Poles: roots of the denominator polynomial in z
- Unit circle: |z| = 1, the stability boundary
- Difference equation: the time-domain form of a recursive filter