?? fre_sample_fir_tri.m
字號:
% Name:fre_sample_fir_tri.m
clear,close all;
N=input('Type in the length N=');
k=0:N-1;
w=pi*k;
H=w.*(u(w)-u(w-0.2*pi))-(w-0.4*pi).*(u(w-0.2*pi)-u(w-0.4*pi));
%k=0:N-1;
phai=-pi*k*(N-1)/N;
H=H.*exp(i*phai);
kc=N/2;
He=conj(H);
for i=0:kc+1
H(N-(i+1))=H(mod(-(i+1),N));
end
subplot(221)
stem(w/pi,abs(H),'.');grid on
axis([0,1,0,1])
title('The sampled frequency response of Hd')
h=ifft(H,N);
subplot(222)
n=0:N-1;
stem(n,h,'.');grid on
title('The impulse response h(n) of an FIR filter')
%axis([0,N-1,min(h),max(h)])
H=fft(h,1024);
k=0:1023;
subplot(223)
plot(k,abs(H))
%axis([0,pi,0,1]);
grid on
subplot(224)
plot(k,20*log10(abs(H)))
%axis([0,1,-100,0])
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -