?? 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 + -