Frequency-Domain FIR Filter

Filter input signal in the frequency domain

  • Library:
  • DSP System Toolbox / Filtering / Filter Implementations

Description

The Frequency-Domain FIR Filter block implements frequency-domain, fast Fourier transform (FFT)-based filtering to filter a streaming input signal. In the time domain, the filtering operation involves a convolution between the input and the impulse response of the finite impulse response (FIR) filter. In the frequency domain, the filtering operation involves the multiplication of the Fourier transform of the input and the Fourier transform of the impulse response. The frequency-domain filtering becomes more efficient than time-domain filtering as the impulse response grows longer. You can specify the filter coefficients directly in the frequency domain by setting Numerator domain to Frequency.

This block uses the overlap-save and overlap-add methods to perform the frequency-domain filtering. For filters with a long impulse response length, the latency inherent to these two methods can be significant. To mitigate this latency, the Frequency-Domain FIR Filter block partitions the impulse response into shorter blocks and implements the overlap-save and overlap-add methods on these shorter blocks. To partition the impulse response, select the Partition numerator to reduce latency check box. For more details on these two methods and on reducing latency through impulse response partitioning, see Algorithms.

Ports

Input

expand all

Data input, specified as a vector or matrix. This block supports variable-size input signals. That is, you can change the input frame size (number of rows) even after calling the algorithm. However, the number of channels (number of columns) must remain constant.

This port is unnamed until you select the Specify coefficients from input port parameter.

Data Types: single | double
Complex Number Support: Yes

Time domain FIR filter coefficients, specified as a row vector.

Dependencies

This port appears when you set Numerator domain to Time and select the Specify coefficients from input port parameter.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32
Complex Number Support: Yes

Frequency domain FIR filter coefficients, specified as a row vector or a matrix. When you clear the Partition numerator to reduce latency parameter, the coefficients input through this port must be a row vector. The FFT length is equal to the length of the vector input. When you select the Partition numerator to reduce latency parameter, Frequency response must be a 2P-by-N matrix, where P is the partition size, and N is the number of partitions.

Dependencies

This port appears when you set Numerator domain to Frequency and select the Specify frequency response from input port parameter.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32
Complex Number Support: Yes

Output Arguments

expand all

Filtered output, returned as a vector or matrix. The size, data type, and complexity of the output match those of the input.

This port is unnamed until you select the Output filter latency parameter and click Apply.

Data Types: single | double
Complex Number Support: Yes

Filter latency, returned as a scalar. This latency is inherent to overlap-add and overlap-save methods and does not include the group delay of the filter. This port appears only when you select the Output filter latency check box.

This port is unnamed until you select the Output filter latency check box and click Apply.

Data Types: uint32

Parameters

expand all

Filtering method in the frequency domain, specified as either Overlap-save or Overlap-add. For more details on these two methods, see Algorithms

Domain of the filter coefficients, specified as one of the following:

  • Time –– Specify the time-domain filter coefficients in the Filter coefficients parameter or through the NUM input port.

  • Frequency –– Specify the filter's frequency response in the Frequency response parameter or through the NUMFFT input port.

When you select this check box, the FIR filter coefficients are input through the port, NUM. When you clear this check box, the coefficients are specified on the block dialog through the Filter coefficients parameter.

To view the filter response, clear this check box, specify the coefficients on the block dialog, and click on the View Filter Response button.

Dependencies

To enable this parameter, set Numerator domain to Time.

FIR filter coefficients, specified as a row vector.

Dependencies

To enable this parameter, set Numerator domain to Time and clear the Specify coefficients from input port parameter.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64
Complex Number Support: Yes

When you select this check box, the FIR filter coefficients in the frequency domain are input through the port, NUMFFT. When you clear this check box, the coefficients are specified on the block dialog through the Frequency response parameter.

To view the filter response, clear this check box, specify the frequency response on the block dialog, and click on the View Filter Response button.

Dependencies

To enable this parameter, set Numerator domain to Frequency.

Frequency response of the filter, specified as a row vector or a matrix. When you clear the Partition numerator to reduce latency parameter, Frequency response must be a row vector. The FFT length is equal to the length of the Frequency response vector. When you select the Partition numerator to reduce latency parameter, Frequency response must be a 2P-by-N matrix, where P is the partition size, and N is the number of partitions.

Dependencies

To enable this parameter, set Numerator domain to Frequency and clear the Specify frequency response from input port parameter.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32
Complex Number Support: Yes

Flag to partition the numerator to reduce latency, specified as one of the following:

  • off –– The filter uses the traditional overlap-save or overlap-add method. The latency in this case is FFT length – NumLen + 1. NumLen is the length of the numerator vector you specify in the Filter coefficients parameter.

  • on –– In this mode, the block partitions the numerator into segments of length specified by the Numerator partition length parameter. The filter performs overlap-save or overlap-add on each partition, and combines the partial results to form the overall output. The latency is now reduced to the partition length.

Partition length of the numerator, specified as a positive integer less than or equal to the length of the numerator.

Dependencies

This parameter applies only when you set Numerator domain to Time and select the Partition numerator to reduce latency parameter.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Time-domain numerator length, specified as a positive integer-valued scalar.

Dependencies

This parameter applies only when you set Numerator domain to Frequency and clear the Partition numerator to reduce latency check box.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32

When you select this check box, the FFT length equals twice the numerator length. When you clear this check box, you specify the FFT length through the FFT length parameter.

Dependencies

This parameter applies only when you set Numerator domain to Time and clear the Partition numerator to reduce latency parameter.

The FFT length you specify must be greater than or equal to the length of the numerator vector you specify in the Filter coefficients parameter.

Dependencies

This parameter applies when you set Numerator domain to Time, clear the Partition numerator to reduce latency and the Inherit FFT length from numerator length parameters.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Flag to specify if the filter is real, specified as true or false.

Dependencies

This parameter applies when Numerator domain to Frequency.

When you select this check box and click Apply, the block outputs the filter latency through the latency port.

Opens the Filter Visualization Tool (FVTool) and displays the magnitude/phase response of the FIR filter. The response is based on the block dialog parameters. Changes made to these parameters update FVTool.

To update the magnitude response while FVTool is running, modify the block dialog parameters and click Apply.

To view the filter response when the Numerator domain is set to Time, clear the Specify coefficients from input port check box. To view the filter response when the Numerator domain is set to Frequency, clear the Specify frequency response from input port check box.

  • Code generation — Simulate model using generated C code. The first time you run a simulation, Simulink® generates C code for the block. The C code is reused for subsequent simulations, as long as the model does not change. This option requires additional startup time but provides faster simulation speed than Interpreted execution.

  • Interpreted execution — Simulate model using the MATLAB®  interpreter. This option shortens startup time but has slower simulation speed than Code generation.

Block Characteristics

Data Types

double | single

Direct Feedthrough

no

Multidimensional Signals

no

Variable-Size Signals

yes

Zero-Crossing Detection

no

Algorithms

expand all

Overlap-save and overlap-add are the two frequency-domain FFT-based filtering methods this algorithm uses.

References

[1] Stockham, T. G., Jr. "High Speed Convolution and Correlation." Proceedings of the 1966 Spring Joint Computer Conference, AFIPS, 28 (1966): 229–233.

Extended Capabilities

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

Introduced in R2017b