| Filter Design Toolbox | ![]() |
Construct a multirate filter object
Syntax
Description
hm = mfilt. returns the object structure(input1,input2,...)
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, meaning 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.cicdecim |
Cascaded integrator-comb decimator |
mfilt.cicdecimzerolat |
Zero-latency cascaded integrated-comb decimator |
mfilt.cicinterp |
Cascaded integrator-comb interpolator |
mfilt.cicinterpzerolat |
Zero-latency cascaded integrator-comb interpolator |
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.linearinterp |
FIR Linear interpolator |
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 to you--refer to the reference page for the structure that interests you for more information.
hm=mfilt.firdecim(m) hm = FilterStructure: 'Direct-Form FIR Polyphase Decimator' Numerator: [1x73 double] DecimationFactor: 3 NonProcessedSamples: [] 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.
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 sampling frequency: 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.
FilterStructure: 'Direct-Form FIR Polyphase Decimator' Numerator: [1x73 double] DecimationFactor: 3 NonProcessedSamples: 0.8963 ResetBeforeFiltering: 'on' States: [72x1 double] NumSamplesProcessed: 10239
Notice that the filter processed 10239 samples with 1 nonprocessed 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
| maxstep | mfilt.cicdecim | ![]() |
Learn more about the latest releases of MathWorks products: |
| © 1994-2009 The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |