Sample rate converter with arbitrary conversion factor
mfilt.farrowsrc will be removed in a future
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
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.
You can use the
to create a Simulink® block of a filter created using
The following table describes the input arguments for creating
Interpolation factor for the filter.
Decimation factor for the filter.
Coefficients for the filter. When no input arguments
are specified, the default coefficients are
hm = mfilt.farrowsrc constructs
the filter using the default values for
hm = mfilt.farrowsrc(l,...) constructs
the filter using the input arguments you provide and defaults for
the argument you omit.
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
The next table describes each property for an
Reports the type of filter object. You cannot set this
property — it is always read only and results from your choice
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.
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.
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 stem((n(2:50)-1)/(Fs*L/M),y(2:50),'r','filled') 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: