# Moving average filter for sound in MATLAB [closed]

y[n] = b0x[n] +b1x[n-1]


I have this MA filter in matlab as following

 load handel;
x = y;

b0 = 0.5;
b1 = 0.5;

N = length(x); % Length of input signal
y = zeros(size(x)); % Allocate space for outut

y(1) = b0*x(1); % First sample, assuming x(0) = 0
for n=2:N % Remaining samples
y(n) = b0*x(n) + b1*x(n-1);
end;

soundsc(y,Fs);


I was asked to listen to the signal and describe it , well I have run the load handel without filter in matlab than i have run the signal with this filter , it sounds like that with filter the signal sounds more demped and less noise compared without filter and when i changed the b1 to b1 =-0.5 it hears only the descant the base of sound is gone . Now I want to know the reason behind.

1. What is the effect of the filter on the input signal which pass through the system?
2. what is the effect of the filter on input signal which pass through the system if we change b0= 0.5 and b1 = -0.5?
• well, 1. it's a moving average! 2. it's the opposite of a moving average! I'm sure you've had your own considerations so far, and we won't be giving you a complete introduction to discrete system theory as answer. Can you please narrow down your question? Run the thing, plot the signals, compare, explain what you did and did not expect. (PS: Homework questions, and this looks extremely much like one, are OK, but you really need to explain what you've considered so far) – Marcus Müller Mar 23 '19 at 10:24
• I was asked to listen to the signal and describe it , well I have run the load handel  without filter in matlab than i have run the signal with this filter , it sounds like that the signal sounds more demped and less noise and when i changed the b1 to b1 =-0.5 i hear only the discant the base of sound is gone . Now I want to know the reason behind – Adam Mar 23 '19 at 10:47
• very nice! Should be part of your question! so, what are your thoughts on these phenomena? Please edit your question to include the info you just gave in your comment, and your thoughts. – Marcus Müller Mar 23 '19 at 12:07