Discrete Filter
Infinite impulse response (IIR) filter model.
Description
The Discrete Filter block independently filters each channel of the input signal with the specified digital NIR filter.
You can specify the filter structure as Direct form I
, Direct form I transposed
, Direct form II
or Direct form II transposed
.
The block implements a static filter with fixed coefficients. Each channel of the input signal is filtered independently in time.
The Numerator coefficients parameter specifies the filter numerator polynomial coefficients. The Denominator coefficients parameter sets the coefficients of the denominator polynomial of the function.
The coefficients of the numerator and denominator polynomials are set in ascending order of degrees . The Discrete Filter block allows you to use polynomials in (delay operator) to represent a discrete system. This approach is typically used in digital signal processing (DSP). In contrast, the Discrete Transfer Fcn block allows polynomials from to be used to represent a discrete system. This approach is more common in control systems. When the numerator and denominator polynomials have the same length, the two approaches are equivalent.
Initial states
-
If the initial value is a scalar, then this initial value is used for each channel for each delay.
-
If the initial value is an array, then the dimension expansion is used.
Consider an example. Let the initial value be
[s1, s2, s3]
. In that case it is a column vector, so it can be written as follows for clarity:[ s1, s2, s3, ]
Suppose we have one channel. Then s1 is the initial condition for the first delay, s2 for the second delay, etc. If there are several channels, all this is true for each separate channel.
The second example is
[s1 s2 s3]
. This is a row matrix. If the filter has three delays, then after expanding the dimensionality, the initial conditions are:[ s1 s2 s3; s1 s2 s3; s1 s2 s3; ]
In this case, the initial conditions for the first channel delays are
[s1, s1, s1]
, for the second channel delays are[s2, s2, s2]
, and so on.It is possible that the number of dimensions is larger. The general rule: the first dimension corresponds to initial conditions for different delays, the following dimensions correspond to different channels. Channels can be elements not only of a vector, but also of a matrix and arrays of higher dimensions.
The number of delays is determined as written above. For Direct form I
and Direct form I transposed
the number of delays for the numerator equals the length of the numerator minus 1, for the denominator equals the length of the denominator minus 1. For Direct form II
and Direct form II transposed
the maximum of the denominator and numerator lengths minus 1.
The Initial states parameter specifies the initial states for filter delays.
How to determine the number of initial state values to be set and how exactly to set them is described in the table below. It gives permissible initial states and the number of delay elements (filter states). The Initial states parameter can take one of four forms as described in the table.
Initial state | Examples | Description |
---|---|---|
Scalar |
5 Each delay element for each channel is set to 5. |
The block initialises all delay elements in the filter with a scalar value of |
Vector or matrix (to apply different delay elements to each channel) |
For a three-channel input signal and a filter with two delay elements: ] or
The delay elements for channel 1 are . The delay elements for channel 2 are . The delay elements for channel 3 are . |
Each element of the vector or matrix specifies a unique initial condition for the corresponding delay element in the corresponding channel:
|
Ports
Parameters
Filter Structure - filter structure
Direct form II (by default)
| Direct form I transposed
| Direct form I
| Direct form II transposed
Sets the discrete structure of the IIR filter.
Block parameter |
|
Values |
|
By default |
|
Numerator coefficients - numerator coefficients
[1.0] (by default)
| scalar
| vector
| matrix
| multidimensional array
Numerator coefficients of a discrete filter as decreasing degrees of z
. Use a column vector to specify the coefficients for a single polynomial of the numerator.
Block parameter |
|
Values |
|
By default |
|
Denominator coefficients - denominator coefficients
[1.0, 0.5] (by default)
| scalar
| vector
| matrix
| multidimensional array
Denominator coefficients of a discrete filter as decreasing degrees of z
. Use a column vector to specify the coefficients for a polynomial with a single denominator.
Block parameter |
|
Values |
|
By default |
|
Initial states - initial states of the filter
0.0 (by default)
| scalar
| vector
| matrix
| multidimensional array
Initial filter states as a scalar, vector or matrix.
Dependencies
To use this port, set the Filter Structure parameter to Direct form II
or Direct form II transposed
.
Block parameter |
|
Values |
|
By default |
|
Initial states on numerator side - initial states of numerator
0.0 (by default)
| scalar
| vector
| matrix
Specify the initial states of the filter numerator as a scalar, vector or matrix.
Dependencies
To use this port, set the Filter Structure parameter to Direct form I
or Direct form I transposed
.
Block parameter |
|
Values |
|
By default |
|
Initial states on denominator side - initial states of denominator
0.0 (by default)
| scalar
| vector
| matrix
Initial states of the filter denominator as a scalar, vector or matrix.
Dependencies
To use this port, set the Filter Structure parameter to Direct form I
or Direct form I transposed
.
Block parameter |
|
Values |
|
* By default* |
|
Sample time (-1 for inherited) - interval between calculation steps
-1.0 (by default)
| scalar
Specify the interval between calculation steps as a non-negative number. To inherit the calculation step, set this parameter to -1
.
Block parameter |
|
Values |
|
By default |
|