This is machine translation

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

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

dsp.FIRRateConverter System object

Sample rate converter


The FIRRateConverter performs sampling rate conversion by a rational factor on a vector or matrix input. The FIR rate convertor cascades an interpolator with a decimator. The interpolator upsamples the input by the upsampling factor, L, followed by a lowpass FIR filter. The FIR filter acts both as an anti-imaging filter and an anti-aliasing filter prior to decimation. The decimator downsamples the output of upsampling and FIR filtering by the downsampling factor M. You must use upsampling and downsampling factors that are relatively prime, or coprime. The resulting discrete-time signal has a sampling rate L/M times the original sampling rate.

To perform sampling rate conversion:

  1. Define and set up your FIR sample rate converter. See Construction.

  2. Call step to perform sampling rate conversion according to the properties of dsp.FIRRateConverter. The behavior of step is specific to each object in the toolbox.


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.


firrc = dsp.FIRRateConverter returns a FIR sample rate converter, firrc, that resamples an input signal at a rate 3/2 times the original sampling rate.

firrc = dsp.FIRRateConverter('PropertyName',PropertyValue, ...) returns an FIR sample rate converter, firrc, with each property set to the specified value.

firrc = dsp.FIRRateConverter(L,M,NUM,'PropertyName', PropertyValue, ...) returns an FIR sample rate converter, firrc, with the InterpolationFactor property set to L, the DecimationFactor property set to M, the Numerator property set to NUM, and other specified properties set to the specified values.



Interpolation factor

Specify the integer upsampling factor. The default is 3.


Decimation factor

Specify the integer downsampling factor. The default is 2.


FIR filter coefficients

Specify the FIR filter coefficients in powers of z-1. The length of filter coefficients must exceed the interpolation factor. Use a lowpass with normalized cutoff frequency no greater than min(1/InterpolationFactor, 1/DecimationFactor). All initial filter states are zero. The default is firpm(70,[0 0.28 0.32 1],[1 1 0 0]).

 Fixed-Point Properties


resetReset states of FIR sample rate converter
stepResample input with FIR rate converter
Common to All System Objects

Create System object with same property values


Expected number of inputs to a System object


Expected number of outputs of a System object


Check locked states of a System object (logical)


Allow System object property value changes


expand all

This example shows how to resample a 100 Hz sine wave signal by a factor of 3:2.

Note: This example runs only in R2016b or later. If you are using an earlier release, replace each call to the function with the equivalent step syntax. For example, myObject(x) becomes step(myObject,x).

sine = dsp.SineWave(1, 100,'SampleRate', 5000,'SamplesPerFrame', 50);

Create a FIR rate converter filter. The default interpolation factor is 3 and decimation factor is 2.

firrc = dsp.FIRRateConverter; 
input = sine();
output = firrc(input);

Plot the original and resampled signals.

ndelay = round(length(firrc.Numerator)/2/firrc.DecimationFactor);
indx = ndelay+1:length(output);
x = (0:length(indx)-1)/sine.SampleRate*firrc.DecimationFactor/firrc.InterpolationFactor;
stem((0:38)/sine.SampleRate, input(1:39)); hold on;
stem(x, firrc.InterpolationFactor*output(indx),'r');

Note: This example runs only in R2016b or later. If you are using an earlier release, replace each call to the function with the equivalent step syntax. For example, myObject(x) becomes step(myObject,x).

This example shows how to resample and play an audio signal from 48 kHz to 32 kHz on a Windows® platform.

afr = dsp.AudioFileReader('audio48kHz.wav', ...
    'OutputDataType', 'single', ...
    'SamplesPerFrame', 300);
adw = audioDeviceWriter(32000);

Create an FIRRateConverter System object with interpolation factor = 2, decimation factor = 3. Default FIR filter coefficients define a lowpass filter with normalized cutoff frequency of 1/3.

firrc = dsp.FIRRateConverter(2,3);

while ~isDone(afr)
    audio1 = afr();
    audio2 = firrc(audio1);



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

Extended Capabilities

Introduced in R2012a

Was this topic helpful?