📄 ex_07_01_1.m
字号:
% 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -