Documentation Center

  • Trial Software
  • Product Updates

Contents

mfilt.farrowsrc

Sample rate converter with arbitrary conversion factor

Syntax

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

Description

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

Description

l

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

m

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

c

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.

Name

Values

Description

FilterStructure

String

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

Arithmetic

String

Reports the arithmtetic precision used by the filter.

Coefficients

Vector

Vector containing the coefficients of the FIR lowpass filter

InterpolationFactor

Integer

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

DecimationFactor

Integer

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

PersistentMemory

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.

Examples

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:

Was this topic helpful?