% Plotting frequency response
w = -3.14:0.01:3.14;
H = (1+exp(-1i*w)+exp(-2i*w))/3;
Hr = real(H);
Hi = imag(H);
Hmag = abs(H);
Hphase = atan(Hi./Hr);
Hphase2 = atan2(Hi,Hr); % same as 'angle(H)'
figure(1); plot(w,Hmag);
figure(2); plot(w,20*log10(Hmag));
figure(3); semilogy(w,Hmag);
figure(4); plot(w,Hphase);
figure(5); plot(w,Hphase2);

% Sound example
x = randn(1,5000);
y = conv(x,ones(1,15)/15);
sound(x);
sound(y);

