This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

dsp.FIRDecimator System object

Package: dsp

Polyphase FIR decimator


The FIRDecimator object resamples vector or matrix inputs along the first dimension. The object reseamples at a rate M times slower than the input sampling rate, where M is the integer-valued downsampling factor. The decimation combines an FIR anti-aliasing filter with downsampling. The FIR decimator object uses a polyphase implementation of the FIR filter.

To resample vector or matrix inputs along the first dimension:

  1. Define and set up your FIR decimator. See Construction.

  2. Call step to resample the vector or matrix inputs according to the properties of dsp.FIRDecimator. The behavior of step is specific to each object in the toolbox.

    Note:   Starting in R2016b, instead of using the step method to perform the operation defined by the System object™, you can call the object with arguments, as if it were a function. For example, y = step(obj,x) and y = obj(x) perform equivalent operations.


H = dsp.FIRDecimator returns an FIR decimator, H, which applies an FIR filter with a cutoff frequency of 0.4*pi radians/sample to the input and downsamples the filter output by factor of 2. This System object supports variable-size input.

H = dsp.FIRDecimator ('PropertyName',PropertyValue, ...) returns an FIR decimator, H, with each property set to the specified value.

H = dsp.FIRDecimator(DECIM, NUM, 'PropertyName',PropertyValue, ...) returns an FIR decimator, H, with the integer-valued DecimationFactor property set to DECIM, the Numerator property set to NUM, and other specified properties set to the specified values.



Decimation factor

Specify the downsampling factor as a positive integer. The FIR decimator reduces the sampling rate of the input by this factor. The size of the input along the first dimension must be a multiple of the decimation factor. The default is 2.


FIR filter coefficient source

Specify the source of the numerator coefficients as one of 'Property' (default) or 'Input port'. When you specify 'Input port', the filter object requires the numerator coefficients to be specified as the third argument to every step.


FIR filter coefficients

Specify the numerator coefficients of the FIR filter in powers of z–1. The following equation defines the system function for a filter of length L:


To prevent aliasing as a result of downsampling, the filter transfer function should have a normalized cutoff frequency no greater than 1/DecimationFactor. You can specify the filter coefficients as a vector in the supported data types. The FIR decimator does not support dfilt objects as sources of the filter coefficients. The default is fir1(35,0.4).


Filter structure

Specify the implementation of the FIR filter as either Direct form or Direct form transposed. The default is Direct form.

 Fixed-Point Properties


cloneCreate FIR decimator object with same property values
freqzFrequency response
fvtoolOpen filter visualization tool
getNumInputsNumber of expected inputs to step method
getNumOutputsNumber of outputs of step method
impzImpulse response
isLockedLocked status for input attributes and nontunable properties
phasezUnwrapped phase response
releaseAllow property value and input characteristics changes
resetReset filter states of FIR decimator
stepDecimate input by integer factor

More Analysis Methods for Filter System Objects.


Polyphase Subfilters

A polyphase implementation of an FIR decimator splits the lowpass FIR filter impulse response into M different subfilters, where M is the downsampling, or decimation factor. Let h(n) denote the FIR filter impulse response of length L and u(n) the input signal. Decimating the filter output by a factor of M is equivalent to the downsampled convolution:


The key to the efficiency of polyphase filtering is that specific input values are only multiplied by select values of the impulse response in the downsampled convolution. For example, letting M=2, the input values u(0),u(2),u(4), ... are only combined with the filter coefficients h(0),h(2),h(4),..., and the input values u(1),u(3),u(5), ... are only combined with the filter coefficients h(1),h(3),h(5),.... By splitting the filter coefficients into two polyphase subfilters, no unnecessary computations are performed in the convolution. The outputs of the convolutions with the polyphase subfilters are interleaved and summed to yield the filter output. The following MATLAB® code demonstrates how to construct the two polyphase subfilters for the default order 35 filter in the Numerator property and the default DecimationFactor property value of two:

M = 2; 
Num = fir1(35,0.4);
FiltLength = length(Num);
Num = flipud(Num(:));

if (rem(FiltLength, M) ~= 0)
     nzeros = M - rem(FiltLength, M);
     Num = [zeros(nzeros,1); Num];  % Appending zeros

len = length(Num);
nrows = len / M;
PolyphaseFilt = flipud(reshape(Num, M, nrows).');

The columns of PolyphaseFilt are subfilters containing the two phases of the filter in Num. For a general downsampling factor of M , there are M phases and therefore M subfilters.


expand all

This example shows how to decimate a sum of sine waves with angular frequencies of pi/4 and 2pi/3 radians/sample by a factor of two. To prevent aliasing, the FIR decimator filters out the 2pi/3 radians/sample component before downsampling.

x = cos(pi/4*[0:95]')+sin(2*pi/3*[0:95]');
H = dsp.FIRDecimator;
y = H(x);

View group delay of default FIR filter


Group delay of the default linear-phase FIR filter is 17.5 samples. Downsampling by a factor of two expect an approx. 8.75 sample delay in the output y with the initial filter states of zero

stem(x(1:length(x)/2),'b','markerfacecolor',[0 0 1]);
title('Input Signal');
stem(y,'b','markerfacecolor',[0 0 1]);
title('Output--Lowpass filtered and downsampled by 2');

This example shows how to reduce the sampling rate of an audio signal by 1/2 and plays it.

hmfr = dsp.AudioFileReader('OutputDataType',...
hap = audioDeviceWriter(22050/2);
hfirdec = dsp.FIRDecimator;

while ~isDone(hmfr)
     frame = step(hmfr);
     y = step(hfirdec, frame);
     step(hap, y);



This object implements the algorithm, inputs, and outputs described on the FIR Decimation block reference page. The object properties correspond to the block parameters, except:

  • Framing – The FIR decimator object only supports Maintain input frame rate

  • Output buffer initial conditions – The FIR decimator object does not support this parameter.

  • Rate options – The FIR decimator object does not support this parameter.

  • Input processing The FIR decimator object does not support this parameter.

Introduced in R2012a

Was this topic helpful?