Discrete

DigitalFilter Block

2nd-Order Digital Butterworth Filter

Open DigitalFilter in BlockWerk →

# Digital Filter Block

Description

The DigitalFilter block is a highly advanced signal processing tool designed to filter discrete-time signals during a simulation. It supports various traditional Infinite Impulse Response (IIR) filter approximations (Butterworth, Chebyshev I, Bessel) in cascading biquad structures, as well as Finite Impulse Response (FIR) Moving Average filters.

It calculates coefficients dynamically based on the current sample frequency (derived from the solver's fixed step size) to ensure mathematically accurate filtering in real-time.

Filter Types (IIR only)

Design Methods

Butterworth

Provides a maximally flat magnitude response in the passband. It sacrifices roll-off steepness for a flat passband. Ideal for general-purpose anti-aliasing.

Chebyshev I

Allows for a steeper roll-off (transition band) at the expense of ripples in the passband.

Bessel

Optimized to have a maximally flat group delay (linear phase response). This preserves the wave shape of filtered signals in the time domain, meaning it avoids overshoot and ringing when filtering step-like changes. The trade-off is a very slow transition/roll-off compared to Butterworth and Chebyshev.

Moving Average (FIR)

A robust and unconditionally stable filter that computes the unweighted mean of the previous $N$ samples.

Parameters

Mathematical Model

For IIR filters, the block cascades $N/2$ Biquadratic (Biquad) sections in the form: $y[n] = b_0 x[n] + b_1 x[n-1] + b_2 x[n-2] - a_1 y[n-1] - a_2 y[n-2]$ The $Q$-factors and pole locations are calculated dynamically based on the chosen design method and filter order.

For the Moving Average filter, the block implements a circular buffer: $y[n] = \frac{1}{N} \sum_{k=0}^{N-1} x[n-k]$

Warning: Nyquist Limit

To prevent instability and aliasing, the Cutoff Frequency must be lower than the Nyquist limit, which is exactly half of the solver's sample frequency. $F_{nyquist} = \frac{1}{2 \cdot \text{step\_size}}$ If the cutoff frequency exceeds this limit, the block will internally clamp it to avoid simulation crashes. It is strongly advised to decrease the simulation step size (increase sample frequency) if you need to filter very high frequencies.