⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fre_fir.m

📁 经典《信号与系统》教程的matlab例程,对深入理解信号与系统相关概念有很大帮助
💻 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 + -