MATLAB: Does the DECIMATE function not use the specified filter order in MATLAB 6.5 (R13)

correctorderSignal Processing Toolbox

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.

Best Answer

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.