Catto / Topic Map · Signals and Systems Level 2
Signals and Systems · 144 h · Topic 29 of 34

System elements and implementation

Adder, gain and memory: with those three pieces any system can be built. How they are arranged is not a matter of indifference, and that is why no high-order digital filter is implemented in direct form.

Block diagram Direct form Biquad FIR IIR

01Three pieces and nothing else

Any LTI system, however complicated, is built from three elements. There is no fourth:

ElementWhat it doesIn continuous timeIn discrete time
Adder\( y = x_1 + x_2 \)A node, or a summing amplifierAn addition
Gain\( y = a\,x \)A resistive divider, a stageA multiplication
MemoryStores the pastAn integrator: capacitor or inductorA delay \( z^{-1} \): a register

The memory row is the important one. Without it, a system can only respond to the present value —it would be static— and there would be neither filters nor dynamics. In an analog circuit that memory is the energy stored in a capacitor; in a processor, a memory location that holds the previous sample.

\[ y[n] = \sum_{k=0}^{M} b_k\,x[n-k] \;-\; \sum_{k=1}^{N} a_k\,y[n-k] \] Each \( x[n-k] \) and each \( y[n-k] \) is a delay; each \( b_k \) and each \( a_k \), a gain; and the summation signs, adders. The equation is the diagram.

02From the diagram to the filter

The same transfer function can be built in several ways, and they are not equivalent in the number of components or in numerical behavior. The lab draws the structure, counts the pieces and shows what filter results.

Lab · the block diagram, piece by piece

Choose the structure and look at the diagram: the squares are delays, the triangles gains and the circles adders. Below, the resulting impulse response and magnitude.

03The structures, and why there is more than one

StructureDelaysAdvantageProblem
Direct form I\( M + N \)Comes straight from the equationUses twice the memory
Direct form II\( \max(M,N) \)The minimum number of delaysSensitive to quantization if the order is high
CascadeSame as IIRobust: each section has its own polesYou have to factor and order the sections
ParallelSameErrors do not accumulate between branchesRequires partial fractions

Direct form II is also called canonical because it uses the smallest possible number of memory elements, and it is the one implemented by almost all libraries. Its problem appears at high orders.

Why cascade is used in practice

The coefficients of a real filter are stored with a finite number of bits. In direct form, the denominator coefficients are those of the complete polynomial, and rounding them moves all the roots at once: in an eighth-order filter, a tiny error in one coefficient can push a pole outside the unit circle and make it unstable.

In cascade, on the other hand, the filter is built from second-order sections, each with its two poles. Rounding the coefficients of one section moves only those two, and only slightly. That is why no high-order digital filter is implemented in direct form: it is factored into second-order sections, which in the jargon are called biquads.

04FIR and IIR

FIRIIR
FeedbackNone: \( a_k = 0 \)Yes
Impulse responseFinite: it dies out on its ownInfinite
StabilityAlways stableThe poles must be checked
Linear phaseObtained with symmetric coefficientsNo, unless an all-pass is added
Order for the same selectivityHigh: tens or hundredsLow: just a few
Analog equivalentNoneResembles an RLC

The trade-off is straightforward: an FIR is safer and can have linear phase, but it needs many more coefficients; an IIR achieves the same with a low order, in exchange for keeping an eye on stability and for not being able to have linear phase. For real-time audio, where latency matters, the IIR usually wins; for block processing where phase matters, the FIR.

Memory costs too

A 200-coefficient FIR needs to store 200 past samples and perform 200 multiplications for each output sample. A fourth-order IIR that does something similar needs 4. On a small microcontroller that difference decides whether the filter fits or not, and it is the reason why the filters in embedded instrumentation are almost always cascaded biquads.

05In the lab

Activity 1 · Draw and count

For \( H(z) = \dfrac{1 + 2z^{-1} + z^{-2}}{1 - 0.5z^{-1} + 0.3z^{-2}} \), draw the direct forms I and II, and count the delays, multipliers and adders of each.

Activity 2 · Programming a biquad

Program a second-order section in direct form II on a microcontroller, measure how many cycles it takes per sample and calculate the maximum sampling frequency it supports.

Activity 3 · Breaking a filter with quantization

Design an 8th-order IIR low-pass, round its coefficients to 8 bits in direct form and calculate where the poles end up. Repeat by factoring into four biquads and compare how much they moved in each case.

06Common mistakes

  • Implementing a high order in direct form. Coefficient quantization can make it unstable.
  • Forgetting the sign of the feedback. The \( a_k \) enter subtracted in the difference equation.
  • Confusing order with number of coefficients. An FIR of order \( M \) has \( M+1 \) coefficients.
  • Expecting linear phase from an IIR. It does not have it, unless an all-pass is added to correct it.
  • Not initializing the delay registers. At startup, a filter with garbage inside delivers a transient that can last a long time.

07Self-assessment

What are the three elements of an LTI system?

Adder, gain and memory: an integrator in continuous time, a delay in discrete time.

Why is direct form II called canonical?

Because it uses the smallest possible number of memory elements: \( \max(M,N) \).

Why are high-order filters implemented in cascade?

Because rounding the coefficients in direct form moves all the roots at once; in cascade each section has its own poles and the error stays bounded.

What is a biquad?

A second-order section. High-order filters are built by chaining several of them.

Why is an FIR always stable?

Because it has no feedback: its impulse response has a finite number of terms.

When is an IIR the right choice?

When selectivity is needed with few resources and phase is not critical. It achieves with order 4 what an FIR would need tens of coefficients for.

08Further reading

  • John G. Proakis and Dimitris G. Manolakis. Digital Signal Processing: Principles, Algorithms, and Applications. 4th ed. (Spanish edition, “Tratamiento digital de señales”), Prentice Hall, 2006. All the structures with their diagrams, and the analysis of finite-precision arithmetic effects.
  • Alan V. Oppenheim and Ronald W. Schafer. Discrete-Time Signal Processing. 3rd ed. (Spanish edition, “Tratamiento de señales en tiempo discreto”), Prentice Hall, 2010. The chapter on structures and the one on coefficient quantization effects.
  • Richard G. Lyons. Understanding Digital Signal Processing. 3rd ed., Prentice Hall, 2010. The clearest one for real implementation: biquads, scaling and rounding errors.
Development of the topic “System elements and implementation” of Signals and Systems (Level 2), based on the curriculum of the UTN Electronic Engineering program, 2023 curriculum — Ordinance No. 1849 of the UTN Higher Council. Back to the Topic Map · catto.ar