Why does the DECIMATE function not use the specified filter order in MATLAB 6.5 (R13)?

1 view (last 30 days)
I use the following syntax to specify a 7th order filter to be used in DECIMATE:
decimate(rand(1:100),31,7);
However, when I check the filter that is actually used by putting a breakpoint on line 140 of decimate.m, I see that nfilt (the filter order) is actually set to 6.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
This is the correct behavior. The MATLAB documentation and MATLAB file help does not alert the user to the possibility of DECIMATE not using the specified filter order.
In decimate.m on lines 126 to 132, the code lowers the filter order by evaluating the magnitude response of the filter at the cutoff frequency and comparing it to a threshold value of 1e-6. Depending on the type of CPU used (Pentium, Athlon, etc), the filter order may be reduced from the specified value.
Please see the related SWAT 1-2YWEQD on the reason for implementing the piece of code.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!