Engee documentation

Discrete Filter

Infinite impulse response (IIR) filter model.

discrete filter

Description

Unit Discrete Filter independently filters each channel of the input signal with a 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.

Parameters Numerator coefficients sets the coefficients of the filter numerator polynomial. Parameters Denominator coefficients sets the coefficients of the denominator polynomial of the function.

The coefficients of the numerator and denominator polynomials are set in the order of increasing degrees . Block Discrete Filter allows 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 is the initial condition for the second delay, etc. If there are several channels, then 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 described above. For Direct form I и 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 и Direct form II transposed is the maximum of the denominator and numerator lengths minus 1.

Parameters Initial States sets 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). Parameters Initial States 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:

  • The length of the vector must be equal to the product of the number of input channels and the number of delay elements in the filter.

  • The matrix must have the same number of rows as the number of delay elements in the filter and must have one column for each input channel.

Ports

Output

# OUT_1 — filtered signal
scalar | vector | matrix | multidimensional array

Details

Filtered output signal.

Data types

Float64.

Complex numbers support

No

Input

# u — input signal
scalar | vector | matrix | multidimensional array

Details

An input signal specified as a scalar, vector, matrix or array with any number of dimensions.

Data types

Float16, Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64, Bool

Complex numbers support

No

Parameters

Main

# Filter Structure — filter structure
Direct form I | Direct form I transposed | Direct form II | Direct form II transposed

Details

Sets the discrete structure of the IIR filter.

Values

Direct form I | Direct form I transposed | Direct form II | Direct form II transposed

Default value

Direct form II

Program usage name

FilterStructure

Tunable

No

Evaluatable

No

# Numerator coefficients — numerator coefficients
Scalar / array of real numbers

Details

Numerator coefficients of a discrete filter as decreasing powers of z. Use a column vector to specify the coefficients for a single numerator polynomial.

Default value

[1.0]

Program usage name

Numerator

Tunable

Yes

Evaluatable

Yes

# Denominator coefficients — denominator coefficients
Scalar / array of real numbers

Details

Discrete filter denominator coefficients as decreasing degrees of z. Use column vector to specify the coefficients for a single denominator polynomial.

Default value

[1.0, 0.5]

Program usage name

Denominator

Tunable

Yes

Evaluatable

Yes

# Initial States — initial states of the filter
Scalar / array of real numbers

Details

Initial filter states as a scalar, vector or matrix.

Dependencies

To use this parameter, set parameters Filter Structure value Direct form II or Direct form II transposed.

Default value

0.0

Program usage name

InitialStates

Tunable

Yes

Evaluatable

Yes

# Initial states on numerator side — initial states of the numerator
Scalar / array of real numbers

Details

Specify the initial states of the numerator of the filter as a scalar, vector or matrix.

Dependencies

To use this parameter, set the parameter Filter Structure value Direct form I or Direct form I transposed.

Default value

0.0

Program usage name

InitialStatesNumSide

Tunable

Yes

Evaluatable

Yes

# Initial states on denominator side — initial states of the denominator
Scalar / array of real numbers

Details

Initial states of the denominator of the filter as a scalar, vector or matrix.

Dependencies

To use this port, set parameters Filter Structure value Direct form I or Direct form I transposed.

Default value

0.0

Program usage name

InitialDenominatorStates

Tunable

Yes

Evaluatable

Yes

# Sample time — interval between calculation steps
SampleTime (real number / vector of two real numbers)

Details

Specify the interval between calculation steps as a non-negative number. To inherit a calculation step, set this parameters to -1.

Default value

-1

Program usage name

SampleTime

Tunable

No

Evaluatable

Yes