Moving Average Filter

Medium MATLAB DSP
Solve this problem

Implement an N-point moving average filter in MATLAB. The function takes a vector and window size and returns the filtered signal using convolution.

Constraints

  • Function prototype: y = mov_avg(x,N)
  • Use conv() with ones(N)/N.
  • Return same length as input using 'same'.
  • Vectorized only.
Starter codeMATLAB
1function y = mov_avg(x,N)2% TODO3end