ex_07_01_1.m

来自「清华大学胡广书教授< 数字信号处理理论算法实现>>第二版一书的」· M 代码 · 共 55 行

M
55
字号
%  ex_07_01_1.m :  习题 7.1

clear all;
close all;
 
N=28;
wn=0.25;
b1=fir1(N,wn,'stop',boxcar(N+1));
b2=fir1(N,wn,'stop',hamming(N+1));
 
[h1,w1]=freqz(b1,1,256,1);
[h2,w2]=freqz(b2,1,256,1);
 
n=0:N;
figure('color','w');
 
subplot(2,2,1)
stem(n,b1,'.');
xlabel('boxcar');
grid on;
 
subplot(2,2,3)
plot(w1,abs(h1));
xlabel('w/2\pi');
ylabel('Amplitude')
axis([0 0.5 0 1.2]);
grid on;
 
 
subplot(2,2,2)
stem(n,b2,'.');
xlabel('hamming');
grid on;
subplot(2,2,4)
plot(w2,abs(h2));
grid on;
xlabel('w/2\pi');
ylabel('Amplitude')
axis([0 0.5 0 1.2]);
 
figure('color','w');
subplot(2,2,1)
plot(w1,unwrap(angle(h1)));
grid on;
xlabel('w/2\pi');
ylabel('Phase(degrees)');
axis([0 0.5 -40 0]);
subplot(2,2,2)
plot(w2,unwrap(angle(h2)));
grid on;
xlabel('w/2\pi');
ylabel('Phase(degrees)');
axis([0 0.5 -40 0]);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?