📄 lixiangfir.m
字号:
clear;
close all;
N=21;
wc=3*pi/4;
n=0:N-1;
r=(N-1)/2;
hdn=-sin(wc*(n-r))/pi./(n-r);
if rem(N,2)~=0
hdn(r+1)=1-(wc/pi);
end
hn1=fir1(N-1,wc/pi,'high',boxcar(N));
hn2=fir1(N-1,wc/pi,'high',hamming(N));
subplot(2,2,1)
stem(n,hn1,'.')
line([0,20],[0,]);
title('juxing h(n)');
xlabel('n');ylabel('h(n)');
subplot(2,2,3)
stem(n,hn2,'.')
line([0,20],[0,0]);
title('hamming h(n)');
xlabel('n');ylabel('h(n)');
hn11=fft(hn1,512);
w=2*[0:511]/512;
subplot(2,2,2)
plot(w,20*log10(abs(hn11)))
grid;
axis([0,2,-80,5]);
title('fudu texing');
xlabel('w/pi');ylabel('fudu(dB)');
hn22=fft(hn2,512);
subplot(2,2,4);
plot(w,20*log10(abs(hn22)))
grid;
axis([0,2,-80,5]);
title('fudu texing');
xlabel('w/pi');ylabel('fudu(dB)');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -