0
$\begingroup$

I am implementing the moving average filter in Matlab. Using fvtool on this filter, gave the following output curve, is this group delay curve correct?

Figure 1

Edit:

  1. My confusion is regarding the values of the delay output as well as the constant nature of the curve.

I implemented the filter using 'FilterDesigner' tool in matlab (In which, filter dimensions can be specified in the GUI, which then handles the code itself) Attaching a screenshot of the tool window with filter parameters.

enter image description here

After which I exported this filter as an object called 'Hd'

To plot the filter, I did -

fvtool(Hd)

Which resulted in the curve above (figure 1)

$\endgroup$

1 Answer 1

1
$\begingroup$

You could have added to your question why you doubt the correctness of those numbers. Anyway, the group delay of a moving average is indeed constant. It's just the parameter 'window size' that is off by one. The window size $N$ is the number of taps of the moving average filter, and the group delay is related to the window size by

$$\tau_g=\frac{N-1}{2}$$

However, in your plot, the group delay is half of the window size, so I expect that what is called 'window size' actually equals $N-1$, i.e., the number of taps minus $1$.

$\endgroup$
5
  • $\begingroup$ (I'm sorry, I'm a total beginner and this was needed to be done as a part of a bigger project) While designing the filter, I definitely set the window sizes to be 5,10,13 and 15 and I don't know why its doing N/2 instead of N-1/2. Any inputs on how I can resolve this? edit: Is is possible that while specifying the window size in Matlab for this, it is automatically up-scaling the window size to +1 i.e. 5 to 6? hence giving 6-1/2=2.5 $\endgroup$
    – varungupta
    Jul 22, 2020 at 11:53
  • $\begingroup$ @varungupta: You could add your code to the question. Then it's easier to know what's going on. $\endgroup$
    – Matt L.
    Jul 22, 2020 at 12:13
  • 1
    $\begingroup$ Added the Matlab implementations as suggested. $\endgroup$
    – varungupta
    Jul 22, 2020 at 12:24
  • 2
    $\begingroup$ @varungupta: It says "Filter order: 15", which means that the filter length = order+1=16, and the corresponding group delay is 15/2=7.5. 'Filter order' shouldn't be the same as 'window size', but window size = filter order + 1. $\endgroup$
    – Matt L.
    Jul 22, 2020 at 12:38
  • $\begingroup$ Understood! Thank you so much your help :) $\endgroup$
    – varungupta
    Jul 22, 2020 at 12:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.