关键词不能为空

当前您在: 大学查询网 > 大学 >

广州电视大学武汉理工大学 基于矩形窗、三角窗、海明窗、汉宁窗、布拉克曼窗的FIR数字滤波器设计

作者:高考题库网
来源:https://bjmy2z.cn/daxue
2020-12-07 19:05
tags:数字滤波器

梨花大学建筑-蛇年吉祥语

2020年12月7日发(作者:王冶秋)



1.

基于矩形窗的

FIR

数字低通滤波器设计


参数如下:


主程序:


%

基于矩形窗的

FIR

数字低通滤波器设计



wp=2*pi*1.75/15;



ws=2*pi*3.25/15



w=(wp+ws)/2;



N=ceil(4*pi/(ws-wp));



n=0:1:(N-1);



alpha=(N-1)/2;



m=n-alpha+eps;



hd=sin(w*m)./(pi*m);

%

得到理想低通滤波器



B=boxcar(N);



string=[

'Boxcar,N='

,num2str(N)];



h=hd.*(B)';

%

得到

FIR

数字滤波器



[H,w]=freqz(h,[1],1024);

%

求其频率响应



db=20*log10(abs(H)+eps);

%

得到幅值



pha=angle(H);

%

得到相位



figure(1);



subplot(2,2,1);



stem(n,h,

'r'

);



axis([0,N-1,-0.1,0.35]);



xlabel(

'n'

);



ylabel(

'h(n)'

);



title(

'

实际低通滤波器的

h(n)'

);



text((0.3*N),0.275,string);



subplot(2,2,2);



plot(w/pi,db,

'r'

);



axis([0,1,-100,5]);



xlabel(

'w/pi'

);



ylabel(

'dB'

);



title(

'

衰减 特性

(dB)'

);



grid;



subplot(2,2,3);



plot(w,pha);



hold

on

;



plot(0:4,zeros(5),

'k'

);



title(

'

相频特性

'

);



xlabel(

'

频 率

(rad)'

);



ylabel(

'

相位

(rad)'

);



axis([0,3.2,-4,4]);



subplot(2,2,4);



plot(w,abs(H));



title(

'

频率特性

'

);



xlabel(

'

频率

W(ra d)'

);



ylabel(

'

幅值

'

);



axis([0,3.15,0,1.5]);



text(0.9,1.3,string);







2.

基于矩形窗的带通滤波器的设计



参数如下:






子程序:





function

hd=ideal_bs(Wcl,Wch,N)



alpha=(N-1)/2;



n=0:1:N-1;



m=n-alpha+eps;



hd =[sin(Wch*m)-sin(Wcl*m)]./(pi*m);




function

hd=ideal_bs(Wcl,Wch,N)



alpha=(N-1)/2;



n=0:1:N-1;



m=n-alpha+eps;



hd =[sin(Wch*m)-sin(Wcl*m)]./(pi*m);




主程序:




clear

all

;



Wph=2*pi*4.75/15;



Wpl=2*pi*2.5/15;



Wsl=2*pi/15;



Wsh=2*pi*6.25/15;



tr_width=min((Wpl-Wsl),(Wsh-Wph));

%

过渡带宽度



N=ceil(4*pi/tr_width);

%

滤波器长度



n=0:1:N-1;



Wcl=(Wsl+Wpl)/2;

%

理想滤波器的截止


频率



Wch=(Wsh+Wph)/2;



hd=ideal_bs(Wcl,Wch,N);

%

理想滤波器的单位


冲击响应



w_ham=(boxcar(N))';


< br>string=[

'

矩形窗

'

,

< p>'N='

,num2str(N)];



h=hd.*w_ham;

%

截取取得实际的单位


脉冲响应



[db,mag,pha,w]=freqz_m2(h,[1]);

%

计算实际滤波器


的幅度响应



subplot(3,2,1);stem(n,hd);title(

'

理想脉冲响应

hd(n)'

)



axis([-1,N,-0.5,0.8]);xlabel(

'n'

);ylabel(

'hd(n)'

);



subplot(3,2,2);stem(n,w_ham);axis([-1,N,0 ,1.1]);



xlabel(

'n'

);ylabel(

'w(n)'

);text(1.5,1.3,st ring);



subplot(3,2,3);stem(n ,h);title(

'

实际脉冲响应

h(n)'

);



axis([0,N,-1.4,1.4]);xlab el(

'n'

);ylabel(

'h(n)'

) ;



subplot(3,2,4);plot(w,pha) ;title(

'

相频特性

'

);



axis([0,3.15,-4,4]);xlabel(

'

频率(

rad

'

);ylab el(

'

相位(

?

'

< p>);



subplot(3,2,5);plot(w/p i,db);title(

'

幅度特性(

dB

)< /p>

'

);



axis([0,1,- 80,10]);xlabel(

'

频率(

pi

'

);ylabel(

'

分贝数

'

);



subplot(3,2,6);plo t(w,mag);title(

'

频率特性

'

)



axis([0,3.15,0,1.5]);xlabel (

'

频率(

rad

'

< p>);ylabel(

'

幅值

'

);

< p>






fs=15000;



t=(0:100)/fs;



x=s in(2*pi*t*750)+sin(2*pi*t*5000)+sin(2*pi*t*6100);< /p>



q=filter(h,1,x);



[a,f1]=freqz(x);



f1=f1/pi*fs/2;



[b,f2]=freqz(q);



f2=f2/pi*fs/2;



figure(2);



subplot(2,1,1);



plot(f1,abs(a));



title(

'

输入波形频谱图

'

);

< p>


xlabel(

'

频率

'

);ylabel(

'

幅度

'

)< /p>



subplot(2,1,2);



plot(f2,abs(b));



title(

'

输出波形频谱图

'

);

< p>


xlabel(

'

频率

'

);ylabel(

'

幅度

'

)< /p>








3.

基于矩形 窗的

FIR

数字带阻滤波器设计



参数:





主程序:



clear all;



Wph=2*pi*6.25/15;



Wpl=2*pi/15;



Wsl=2*pi*2.5/15;



Wsh=2*pi*4.75/15;



tr_width=min((Wsl-Wpl),(Wph- Wsh));%

过渡带宽度



N=ceil(4 *pi/tr_width);%

滤波器长度



n=0:1:N-1;



Wcl=(W sl+Wpl)/2;%

理想滤波器的截止频率



Wch=(Wsh+Wph)/2;



hd=ideal_bs(Wcl,Wch,N);%

理想滤波器的单位冲击响应



w_ham=(boxcar(N))';



string=['

矩形窗

','N=',num2str(N )];



h=hd.*w_ham;%

截取取得 实际的单位脉冲响应



[db,mag,pha,w]=fre qz_m2(h,[1]);%

计算实际滤波器的幅度响应



delta_w=2*pi/1000;





subplot(3,2,1 );stem(n,hd);title('

理想脉冲响应

hd(n)')



axis([-1,N,-0.5,0.8]);xlabel(' n');ylabel('hd(n)');



subplot (3,2,2);stem(n,w_ham);axis([-1,N,0,1.1]);




xlabel('n'); ylabel('w(n)');text(1.5,1.3,string);



subplot(3,2,3);stem(n,h);title('

实际 脉冲响应

h(n)');



axis([0,N ,-1.4,1.4]);xlabel('n');ylabel('h(n)');



subplot(3,2,4);plot(w,pha);title('

< p>相频特性

');



axis([0,3.1 5,-4,4]);xlabel('

频率(

rad

< p>');ylabel('

相位(

Φ

');< /p>



subplot(3,2,5);plot(w/pi,db) ;title('

幅度特性(

dB

');



axis([0,1,-80,10]);xlabel('

频率(

pi

');ylabel('

分 贝数

');



subplot(3,2,6); plot(w,mag);title('

频率特性

')



axis([0,3,0,2]);xlabel('

频率(

< p>rad

');ylabel('

幅值

');





fs=15000;



t=(0:100)/fs;



x=s in(2*pi*t*750)+sin(2*pi*t*3000)+sin(2*pi*t*6100);< /p>



q=filter(h,1,x);



[a,f1]=freqz(x);



f1=f1/pi*fs/2;



[b,f2]=freqz(q);



f2=f2/pi*fs/2;



figure(2);



subplot(2,1,1);



plot(f1,abs(a));



title('

输入波形频谱图

');



xlabel('

频率

');ylabel('

幅度

')



subplot(2,1,2);



plot(f2,abs(b));



title('

输出波形频谱图

');



xlabel('

频率

');ylabel('

幅度

')




调用程序

1



function hd=ideal_bs(Wcl,Wch,m);



alpha=(m-1)/2;



n=[0:1:(m-1)];



m=n-alpha+eps;



h d=[sin(m*pi)+sin(Wcl*m)-sin(Wch*m)]./(pi*m)




调用程序

2



function[db,mag,pha,w]=freqz_m2(b,a)



[H,w]=freqz(b,a,1000,'whole');



H=(H(1:1:501))'; w=(w(1:1:501))';



mag=abs(H);



db=20 *log10((mag+eps)/max(mag));



pha=angle(H);



< /p>


4.

基于三角窗的

FIR

数字高通滤波器设 计



参数:




武汉大学代君-个人成长经历范文


天津财经大学珠江学院录取分数线-名人传读后感400字


全国师范大学排名2013-服装促销广告语


第三届全国大学生广告艺术大赛-李宇春语录


云南大学易班-新叶阅读答案


何穗读大学-我是一颗小水珠


中国矿业大学2018年招生计划-繁衍的反义词


NYU大学录取-茶馆读后感600字



本文更新与2020-12-07 19:05,由作者提供,不代表本网站立场,转载请注明出处:https://bjmy2z.cn/daxue/18101.html

武汉理工大学 基于矩形窗、三角窗、海明窗、汉宁窗、布拉克曼窗的FIR数字滤波器设计的相关文章