Moving Average Filter's Magnitude Response

I am working on filtering of data using the Moving average filter in MATLAB.

My data is recorded temperature values on the Y-axis and Time(in seconds) on the X-axis

(I'm getting the magnitude response curve of the Moving average filter as attached) The shape of the curve seems fair for the moving average filter, according to the theory but,

I want to ask, why am I getting all the magnitude value for MA filter positive? (is this correct?)

Implementing other filters like Butterworth etc. on the same data gives the magnitude values to be negative (image attached) Here is my MATLAB Code for MA (if it helps)

%T.Temp is table column containing Temperature values in double format.

MovAvg = dsp.MovingAverage(5)

movAvgOut = MovAvg(T.Temp)

fvtool(movAvgOut)

%Gives output the first image I attached

Any help is appreciated. Thank you.

Ps - DSP is not my field. This work is part of a bigger project i'm involved in, and need some help. Please bear with me if I sound irrational.

• What are your coefficients? All ones?
– jojek
Jul 21 '20 at 12:45
• Just shift your vertical scale. They are not based the same. Jul 21 '20 at 12:48
• @jojek I have implemented MA using the sliding window, and as per the documentation, in this - all values are given equal importance/weightage. So, Yes, I guess all coefficients are 1. Jul 21 '20 at 18:55
• @CedronDawg Do have any insight on how I can shift the vertical scale? Jul 21 '20 at 18:56
• Well, you are using fvtool for visualizing spectrum of your data, not the actual filter. If you want to visualize things the way you want, use fft routine, scale the output with 0 dB being a particular value that you want and plot it. Values of temperature are much higher than 1, so it's normal you get levels higher than 0 dB. (Not sure what would be the meaning of 0 dB for temperature anyway...). Alternatively do this trick. In fvtool click Analysis, Analysis parameters and tick Normalize amplitude to 1 (0 dB). This will normalize the values so that maximum is always 0 d.
– jojek
Jul 21 '20 at 19:23