📄 hamingchuang.m
字号:
wp=0.2*pi;
ws=0.3*pi;
tr_width=ws-wp;
M=ceil(6.6*pi/(ws-wp))+1;
disp(['滤波器长度为',num2str(M)]);
n=0:M-1;
wc=(ws+wp)/2;
hd=ideal_lp(wc,M);
w_ham=(hamming(M))';
h=hd.*w_ham;
[db,mag,pha,grd,w]=freqz_m(h,[1])
delta_w=2*pi/1000;
Rp=-(min(db(1:1:wp/delta_w+1)));
disp(['实际通带为',num2str(Rp)]);
As=-round(max(db(ws/delta_w+1:1:501)));
disp(['最小祖带摔减为',num2str(As)]);
subplot(111)
subplot(221)
stem(n,hd)
title('理想冲击响应');
ylabel('hd(n)');
subplot(222)
stem(n,w_ham);
title('hamming window');
axis([0 M-1 0 1.1]);
ylabel('w(n)');
subplot(223)
stem(n,h);
title('real pulse response');
axis([0 M-1 -0.1 0.3]);
xlabel('n');
ylabel('h(n)');
subplot(224)
plot(w/pi,db)
title('幅度响应(dB)');
axis([0 1 -100 10]);
grid;
xlabel('以pi为单位的频率');
ylabel('分贝数');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -