📄 fre_fir.m
字号:
%==========================================================================
% Name:fre_fir.m
% The program compute the DTFT of discrete-time sequence x(n),
% and plot the curves.
%==========================================================================
clear;
h=input('Type in the impulse response h(n)=');
L=length(h);
n=zeros(1,L);
for i=1:L
n(i)=i-1;
end
W1=2*pi;
N=512;
k=-N:N;
W=k*W1/(N);
H=h*exp(-j*n'*W);
H1=abs(H);
phi=57.3*angle(H);
subplot(3,1,1);stem(n,h,'.');grid on;
xlabel('Index n');ylabel('the curve of h(n)');
title('The frequence response of the filter h(n)');
subplot(3,1,2);plot(W/(pi),H1);grid on;axis([0,2,-0.5,1.2])
xlabel('w');
ylabel('The magnitude response ');
subplot(3,1,3);
plot(W/pi,phi,'r');grid on;axis([0,2,-1.1*180,1.1*180])
xlabel('w');ylabel('The phase response');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -