Digital Filter Design
Design and implement digital FIR and IIR filters
DSP System Toolbox / Filtering / Filter Implementations
Use this block to design, analyze, and efficiently implement floating-point filters.
The Digital Filter Design block implements a digital Finite Impulse Response (FIR) or
Infinite Impulse Response (IIR) filter that you design by using the Filter
filterDesigner) app. This block provides
the same filter implementation as the Discrete FIR Filter or Biquad Filter
You must specify whether the block performs frame-based or sample-based processing on the input
by setting the Input processing parameter. The block applies the
specified filter to each channel of a discrete-time input signal and outputs the result.
The outputs of the block numerically match the outputs of the Discrete FIR Filter or
Biquad Filter block and the MATLAB®
filter function. For more information,
see Getting Started with Filter Designer.
These blocks also implement digital filters, but serve slightly different purposes:
Discrete FIR Filter (Simulink) and Biquad Filter— Use to efficiently implement floating-point or fixed-point filters that you have already designed. These blocks provide the same exact filter implementation as the Digital Filter Design block.
Filter Realization Wizard — Use to implement floating-point or fixed-point filters built from Sum, Gain, and Unit Delay blocks. You can either design the filter within this block, or import the coefficients of a filter that you designed elsewhere.
Port_1 — Input signal
vector | matrix
Signal to filter, specified as a vector or matrix of real values. When given matrix input, the block treats each column as an independent channel.
The sample rate,
Fs, that you specify in the
filter designer app must be identical to the sample rate of the input to
the Digital Filter Design block. When the sampling frequencies do not
match, the Digital Filter Design block returns a warning message and
inherits the sample rate of the input block.
Port_1 — Output signal
vector | matrix
Filtered signal, returned as a vector or a matrix of real values.
For more information about the parameters in this dialog box, see Getting Started with Filter Designer.
Designing the Filter
To open filter designer, double-click the Digital Filter Design block. Use the filter designer to design or import a digital FIR or IIR filter. To learn how to design filters with this block and filter designer, see:
Tuning the Filter During Simulation
You can tune the filter specifications in filter designer during simulations if your changes do not modify the filter length or filter order. As you apply any filter changes in filter designer, the filter is updated.
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Generated code relies on the
memset function (
string.h) under certain
The Digital Filter Design block supports SIMD code generation using Intel AVX2 technology under these conditions:
Input processing is set to
Columns as channels (frame based).
Filter Structure (in Import Filter from Workspace pane) is set to
Direct-Form FIR. You can generate SIMD code even when the filter is a
Direct-Form FIR Transposedfilter. To create a
Direct-Form FIR Transposedfilter, select Edit > Convert Structure, and click Direct-Form FIR Transposed.
Input signal has a data type of
The SIMD technology significantly improves the performance of the generated code.