Main Content

IIR Filter

Implement infinite impulse response (IIR) filter

  • Library:
  • Motor Control Blockset / Signal Management

Description

The IIR Filter block implements a discrete first-order infinite impulse response (IIR) filter on the specified input signal. The block supports fixed-point and floating-point data types. The block is also optimized for code generation.

We recommend that you use fixed-step discrete solver for this block to enable code generation and ensure accurate simulation.

Equations

You can configure the IIR filter by using the filter coefficient (a) block parameter for a given cutoff frequency (fc).

This equation describes computation of the filter coefficient from the cutoff frequency:

a= ( 2πTsfc2πTsfc+1 )

Alternatively, the block also computes the theoretical cutoff frequency for the given sample time using a filter coefficient:

fc= ( a(1a)2πTs )

Use the Filter type parameter to configure the block either as a low-pass or high-pass filter.

Low-pass filter:

y(k)=axk+(1a)yk1

High-pass filter:

y(k)=(1a)xk (1a)xk1+(1a)yk

where:

  • fc is the cutoff frequency of the IIR filter.

  • a is the filter coefficient in the range (0, 1].

  • y(k) is the filtered output value at time k.

  • yk1 is the filtered output value at time k1.

  • xk is the sampled input value at time k.

  • xk1 is the filtered output value at time k1.

  • Ts is the sample time of the IIR Filter block.

Ports

Input

expand all

Sampled values of the raw input signal in the time domain.

Data Types: single | double | fixed point

Output

expand all

Filtered output signal returned by the IIR Filter block in the time domain.

Data Types: single | double | fixed point

Parameters

expand all

Type of the IIR filter.

Filter coefficient of the IIR filter. The data type of this parameter is the same as that of the input signal. We suggest that you check the precision of the parameter value in this data type.

Select this parameter for the block to display the Discrete step size (s) and Theoretical cutoff frequency (Hz) parameters.

Step size of the discrete-time computation (in seconds) used by the IIR filter.

Dependencies

To display this parameter, select the Display cutoff frequency parameter.

Theoretical cutoff frequency (in Hertz) of the IIR filter. This parameter is not configurable.

Dependencies

To display this parameter, select the Display cutoff frequency parameter.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Fixed-Point Conversion
Design and simulate fixed-point systems using Fixed-Point Designer™.

Introduced in R2020a