Question
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.
Expert Answer
John Williams
PhD Expert
Answered Nov 20, 2025
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.
100% Run Guarantee
3-Hour Fast-Track Delivery
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here
Related matlab Questions & Solutions
Browse All →
Explore similar technical troubleshooting questions and verified MATLAB solutions:
Ready-to-Run MATLAB & Simulink Projects
Browse All Projects →