Moving Average filter window size automatically up-scaled by 1

I implemented a moving average filter using the 'FilterDesigner' with the following features (image attached)
I Specified the window size to be 15. (also created other instances of this filter with window sizes 5,10 and 13)
The group delay for MA is calculated by the formula (N-1)/2 but my group delay curve is plotting N/2 instead. (image attached)
where 'N' is the window size.
Does Matlab automatically upscales the window length by +1? i.e
[(15+1)-1] / 2 = 7.5 instead of 15-1/2 = 7

 Accepted Answer

Hi Varun,
In filterDesigner, you have mentioned filter order as 15 and filter taps or length of filter is order+1. The N generally mentioned in literature is number of taps(filter length), hence N = order+1 = 16.
I hope this clarifies your doubt.
Cheers,
Deepak

4 Comments

@Deepak Gupta
Please excuse me if I sound naive,
So to create a MA filter with 'window size 15' i,e. it averages 15 data samples at a time, the 'filter order' needs to be 16, am I correct?
(If yes, then can you please briefly explain what is 'filter order')
Thank you so much for your time and help.
For a window size of 15, you need a filter of order 14.
window size = order+1 as was mentioned earlier.
Order: In simple terms, Order of a filter is defined by the maximum number of delay elements used to design the filter.
Sir,
If you can, please help me with one more conecern.
I desinged a Moving average filter with all the above properties except,
filter order = 6
and 'scale passband' selected.
My data's last 5 fields are -> 34.2700, 34.2700, 34.2700, 34.2800, 34.2800
Simple Moving Average output SHOULD BE = 34.274 by (adding all above/5)
But, I'm getting = 34.2716
Do you know, why?
Thanks.
As your filter order is 6 hence number of filter taps = 6+1 = 7. You need to look at last 7 samples.

Sign in to comment.

More Answers (0)

Products

Release

R2020a

Community Treasure Hunt

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

Start Hunting!