(三)实验内容
题一:生成四种窗函数:矩形窗、三角窗、汉宁窗、海明窗,并观察其频率响应。
N=20;
window1=(boxcar(N))';
[h1,w1]=freqz(window1,1);
subplot(3,1,1);
plot(window1);
title('矩形窗');
grid on;
db1=20*log10(abs(h1))/ max(abs(h1));
subplot(3,1,2);
plot(w1/pi,db1);title('矩形窗频率响应');
grid on;
pha=angle(h1);
subplot(3,1,3);
plot(w1/pi,unwrap(pha));
title('矩形窗相频响应');
grid on;
N=20;
window2=(triang(N))';
[h2,w2]=freqz(window2,1);
subplot(3,1,1);
plot(window2);
title('三角窗');
grid on;
db2=20*log10(abs(h2))/max(abs(h2));
subplot(3,1,2);
plot(w2/pi,db2);
title('三角窗频率响应');
grid on;
pha=angle(h2);
subplot(3,1,3);
plot(w2/pi,unwrap(pha));
title('三角窗相频响应');
grid on;