mfilt - Multirate filter

Syntax

hm = mfilt.structure(input1,input2,...)

Description

hm = mfilt.structure(input1,input2,...) returns the object hm of type structure. As with dfilt and adaptfilt objects, you must include the structure string to construct a multirate filter object. You can, however, construct a default multirate filter object of a given structure by not including input arguments in your calling syntax.

Multirate filters include decimators and interpolators, and fractional decimators and fractional interpolators where the resulting interpolation or decimation factor is not an integer.

Structures

Each of the following multirate filter structures has a reference page of its own.

Filter Structure String

Description of Resulting Multirate Filter

mfilt.cascade

Cascade multirate filters to form another filter

mfilt.cicdecim

Cascaded integrator-comb decimator

mfilt.cicinterp

Cascaded integrator-comb interpolator

mfilt.farrowsrc

Multirate Farrow filter

mfilt.fftfirinterp

Overlap-add FIR polyphase interpolator

mfilt.firdecim

Direct-form FIR polyphase decimator

mfilt.firfracdecim

Direct-form FIR polyphase fractional decimator

mfilt.firfracinterp

Direct-form FIR polyphase fractional interpolator

mfilt.firinterp

Direct-form FIR polyphase interpolator

mfilt.firsrc

Direct-form FIR polyphase sample rate converter

mfilt.firtdecim

Direct-form transposed FIR polyphase decimator

mfilt.holdinterp

FIR hold interpolator

mfilt.iirdecim

IIR decimator

mfilt.iirinterp

IIR interpolator

mfilt.linearinterp

FIR Linear interpolator

mfilt.iirwdfdecim

IIR wave digital filter decimator

mfilt.iirwdfinterp

IIR wave digital filter interpolator

Copying mfilt Objects

To create a copy of an mfilt object, use the copy method.

h2 = copy(hd)

Examples

Create an FIR decimator that uses a decimation factor equal to three. In this case, the only input argument needed is m, the decimation factor. Other input arguments are available — refer to the reference page for the structure that interests you for more information.

m=3;
hm=mfilt.firdecim(m)
 
hm = 
 
             FilterStructure: 'Direct-Form FIR Polyphase Decimator'
                   Numerator: [1x73 double]
            DecimationFactor: 3
    NumberOfSamplesProcessed: 0
                 ResetStates: 'on'
                      States: [72x1 double]

To demonstrate a few of the methods that apply to multirate filters, here are two examples of using hm, your FIR decimator.

Use the Filter Visualization tool to review the magnitude response of your decimator.

Now check to see if your filter is stable.

isstable(hm)

ans =

     1

Finally, pass a signal through the filter to see if it indeed decimates by three.

m = 3;                        % Decimation factor
hm = mfilt.firdecim(m);       % We use the default filter
fs = 44.1e3;                  % Original sample freq: 44.1kHz.
n = 0:10239;                  % 10240 samples, 0.232 second long 
                              % signal
x  = sin(2*pi*1e3/fs*n);      % Original signal, sinusoid at 1 kHz
y = filter(hm,x);            % 5120 samples, still 0.232 seconds
stem(n(1:44)/fs,x(1:44))     % Plot original sampled at 44.1kHz 
hold on                       % Plot decimated signal (22.05kHz) in red
stem(n(1:22)/(fs/m),y(13:34),'r','filled')
xlabel('Time (sec)');ylabel('Signal Value')

Here is the stem plot that shows the result of the decimation process.

 hm =
        FilterStructure: 'Direct-Form FIR Polyphase 
                          Decimator'
               Numerator: [1x73 double]
        DecimationFactor: 3
        PersistentMemory: 'on'
                  States: [72x1 double]

The filter processes 10239 samples with 1 unprocessed sample whose value is 0.8963. One nonprocessed sample results from dividing the number of samples, 10240, by the decimation factor, 3, to get 3413 output samples and one left over.

See Also

mfilt.firfracdecim, mfilt.firfracinterp, mfilt.firinterp, mfilt.firsrc, mfilt.firtdecim

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS