# Moving average filter output magnitude in simulink

I was using the Moving average filter provided by simulink. I set the window length equal to 31 samples and i was using a fixed step solver with a step size of $$\frac{1}{(50\times24)}$$. I used a unit amplitude sine signal with a frequency of 50 Hz as the input to this filter (This signal is sampled at the same rate as the solver step size i.e. $$1/(50\times 24)$$ or $$\sin(\omega_{0} \frac{n}{(50 \times 24)})$$. The filter output magnitude was around (approximately) 0.2 p.u. Now, by changing my solver step size to $$\frac{1}{(50\times24\times31)}$$ (which again is the same as my signal sampling rate i.e $$\sin(\omega_{0} \frac{n}{(50 \times 24 \times 31)})$$), where 31 pertains to the filter window length, the resulting filtered signal had the correct amplitude (approximately 0.9971) 1 p.u.

My questions are as follows, 1) why is the amplitude very low in the filter output when i do not incorporate the filter length in the step size of the solver. 2) How do i correct for this amplitude decrease without changing my solver step size i.e. in the first case.

• Either you have not told us your sampling rate, or simulink is setting your sampling rate according to your fixed solver step. Could you please edit your question to elucidate on this point. – TimWescott Dec 29 '20 at 22:17
• i have edited my question. Go ahead and have a look. – mka_07 Dec 30 '20 at 4:59