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

📄 dtft_beike.m

📁 经典《信号与系统》教程的matlab例程,对深入理解信号与系统相关概念有很大帮助
💻 M
字号:
%==========================================================================
%  Name:DTFT.m
%  The program compute the DTFT of discrete-time sequence x(n),
%  and plot the curves.
%==========================================================================
clear;
n=-5:5;
x1=0.5.^n.*u(n);
x2=0.5.^(-n).*u(-n);
x3=(x1+x2)/2;
x4=(x1-x2)/2;

W1=2*pi;                           
N=512;           
k=-N:N;                              
W=k*W1/(N); 

figure(1)
F1=x1*exp(-j*n'*W);                  
F1_1=abs(F1);                           
phi=57.3*angle(F1);                     

subplot(3,1,1);stem(n,x1,'.');grid on;
ylabel('the curve of x(n)');
title('The DTFT of the sequence x(n)');
subplot(3,1,2);plot(W,F1_1);grid on;
xlabel('w');
ylabel('The magnitude spectra ');
subplot(3,1,3);
plot(W,phi,'r');grid on;
xlabel('w');ylabel('The phase spectra');

figure(2)
F2=x3*exp(-j*n'*W);                  
F2_2=real(F2);                           
phi=57.3*angle(F2);                     

subplot(3,1,1);stem(n,x3,'.');grid on;
ylabel('the curve of x(n)');
title('The DTFT of the sequence x(n)');
subplot(3,1,2);plot(W,F2);grid on;
xlabel('w');
ylabel('The magnitude spectra ');
subplot(3,1,3);
plot(W,phi,'r');grid on;
xlabel('w');ylabel('The phase spectra');

figure(3)
F3=x4*exp(-j*n'*W);                  
F3_3=imag(F3);                           
phi=57.3*angle(F3);                     

subplot(3,1,1);stem(n,x4,'.');grid on;
ylabel('the curve of x(n)');
title('The DTFT of the sequence x(n)');
subplot(3,1,2);plot(W,F3_3);grid on;
xlabel('w');
ylabel('The magnitude spectra ');
subplot(3,1,3);
plot(W,phi,'r');grid on;
xlabel('w');ylabel('The phase spectra');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -