main content

filter input signal in the frequency domain -凯发k8网页登录

filter input signal in the frequency domain

  • frequency-domain fir filter block

libraries:
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 .

examples

ports

input

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

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

filtering method in the frequency domain, specified as either overlap-save or overlap-add. for more details on these two methods, see

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 dynamic filter visualizer window and displays the magnitude and phase response of the frequency domain fir filter. the response is based on the parameters you select in the block dialog box. to update the response while the visualizer is running, modify the parameters in the dialog box and click apply.

you can configure the plot settings and the frequency response measurements from the interface of the visualizer.

on the plot tab, you can enable the legend, specify to plot both magnitude and phase responses of the filter, modify the plot settings, generate a script to re-create the plot, and even save or share the settings.

on the measurements tab, you can enable data cursors, and display the peak values of the filter response.

for more details on the dynamic filter visualizer interface and its tools, see .

specify the type of simulation to run as one of the following:

  • 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

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™.

version history

introduced in r2017b

see also

objects

blocks

网站地图