load('handel')
F_Mi=220*2^(7/12);
F_Resos=220*2^(6/12);
F_Fa=220*2^(8/12);
w1=2*F_Resos/Fs;
w2=2*F_Fa/Fs;
N=1000;
num=fir1(N,[w1 w2],'stop');
den=[1 zeros(1,length(num)-1)];
filtro=tf(num,den,1/Fs);
[mag,fase,w]=bode(filtro);
% subplot(211)
% plot(w/(2*pi),mag(:))
% subplot(212)
% plot(w/(2*pi),fase(:))
t=[0:1/Fs:(length(y)-1)/Fs]';
ruido_Mi=0.3*sin(2*pi*F_Mi*t);
yruidosa=y+ruido_Mi;
yfiltrada=filter(num,den,yruidosa);
Nf=2^17;
Y=fft(y,Nf);
Yruidosa=fft(yruidosa,Nf);
Yfiltrada=fft(yfiltrada,Nf);
F=[-Fs/2:Fs/Nf:Fs/2-Fs/Nf]';
figure
plot(F,abs(fftshift(Yruidosa)))
figure
plot(F,abs(fftshift(Yfiltrada)),F,abs(fftshift(Y)))