《汉宁窗设计FIR带通滤波器》由会员分享,可在线阅读,更多相关《汉宁窗设计FIR带通滤波器(2页珍藏版)》请在金锄头文库上搜索。
1、t=0:1/2000:1;noise=3*randn(size(t);sig1=1+0.8*sin(2*pi*5*t)+0.7*sin(2*pi*10*t);sig2=10*sin(2*pi*185*t+0.4*pi)+5*sin(2*pi*370*t+0.7*pi);sig=sig1.*sig2;noisesig=sig+noise;% plot(z);ws1=0.13*pi;wp1=0.15*pi;As=44;wp2=0.4*pi;ws2=0.42*pi;Rp=1;wp=wp1,wp2;ws=ws1 ws2;delta_w=wp1-ws1;no=ceil(8*pi/delta_w);N=n
2、o+mod(no+1,2);windows=(hanning(N);wc1=(ws1+wp1)/2;wc2=(ws2+wp2)/2;hd=ideal_lp(wc2,N)-ideal_lp(wc1,N);b=hd.*windows;H,w=freqz(b,1);dbH=20*log(abs(H)+eps)/max(abs(H);subplot(2,2,1);plot(w/pi,dbH);subplot(2,2,2);plot(w/pi,abs(H)/pi);newsig=filter(b,1,noisesig);sig1=fft(sig,512);noisesig1=fft(noisesig,512);w=2*0:511/512;figure(2);subplot(3,2,1);plot(t,sig); subplot(3,2,2);plot(w,20*log10(abs(sig1);subplot(3,2,3);plot(t,noisesig);subplot(3,2,4);plot(w,20*log10(abs(noisesig1);subplot(3,2,5);plot(t,newsig);t=0.1:1/2000:1;newsig1=fft(newsig,512);subplot(3,2,6);plot(w,20*log10(abs(newsig1);