This is machine translation

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


Sample rate converter with arbitrary conversion factor


mfilt.farrowsrc will be removed in a future release. Use dsp.FarrowRateConverter instead.


hm = mfilt.farrowsrc(L,M,C)
hm = mfilt.farrowsrc
hm = mfilt.farrowsrc(l,...)


hm = mfilt.farrowsrc(L,M,C) returns a filter object that is a natural extension of dfilt.farrowfd with a time-varying fractional delay. It provides a economical implementation of a sample rate converter with an arbitrary conversion factor. This filter works well in the interpolation case, but may exhibit poor anti-aliasing properties in the decimation case.

    Note:   You can use the realizemdl method to create a Simulink® block of a filter created using mfilt.farrowsrc.

Input Arguments

The following table describes the input arguments for creating hm.

Input Argument



Interpolation factor for the filter. l specifies the amount to increase the input sampling rate. The default value of l is 3.


Decimation factor for the filter. m specifies the amount to decrease the input sampling rate. The default value for m is 2.


Coefficients for the filter. When no input arguments are specified, the default coefficients are [-1 1; 1, 0]

hm = mfilt.farrowsrc constructs the filter using the default values for l, m, and c.

hm = mfilt.farrowsrc(l,...) constructs the filter using the input arguments you provide and defaults for the argument you omit.

mfilt.farrowsrc Object Properties

Every multirate filter object has properties that govern the way it behaves when you use it. Note that many of the properties are also input arguments for creating mfilt.farrowsrc objects. The next table describes each property for an mfilt.farrowsrc filter object.






Reports the type of filter object. You cannot set this property — it is always read only and results from your choice of mfilt object.



Reports the arithmetic precision used by the filter.



Vector containing the coefficients of the FIR lowpass filter



Interpolation factor for the filter. It specifies the amount to increase the input sampling rate.



Decimation factor for the filter. It specifies the amount to increase the input sampling rate.


false or true

Determines whether the filter states are restored to their starting values for each filtering operation. The starting values are the values in place when you create the filter if you have not changed the filter since you constructed it. PersistentMemory returns to zero any state that the filter changes during processing. States that the filter does not change are not affected.


Interpolation by a factor of 8. This object removes the spectral replicas in the signal after interpolation.

 [L,M] = rat(48/44.1);
 Hm = mfilt.farrowsrc(L,M);           % We use the default filter
 Fs = 44.1e3;                         % Original sampling frequency
 n = 0:9407;                          % 9408 samples, 0.213 seconds long
 x  = sin(2*pi*1e3/Fs*n);             % Original signal, sinusoid at 1kHz
 y = filter(Hm,x);                    % 10241 samples, still 0.213 seconds
 stem(n(1:45)/Fs,x(1:45))             % Plot original sampled at 44.1kHz
 hold on
 % Plot fractionally interpolated signal (48kHz) in red
 xlabel('Time (sec)');ylabel('Signal value')
 legend('44.1 kHz sample rate','48kHz sample rate')

The results of the example are shown in the following figure:

Introduced in R2011a

Was this topic helpful?