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

📄 dtft_idtft.m

📁 经典《信号与系统》教程的matlab例程,对深入理解信号与系统相关概念有很大帮助
💻 M
字号:
%==========================================================================
%  Name:example5_4.m
%  The program compute the DTFT of discrete-time sequence x(n),
%  and plot the curves.
%==========================================================================
clear;close all;
n=-20:20;
x=input('Type in the time sequence x[n]=');%u(n)-u(n-1);
w1=2*pi;N=512;k=-N:N;
dw=w1/N;
w=k*w1/(N);
X=x*exp(-j*n'*w);   % Compute the Fourier transform of x[n]
X1=abs(X);
phi=57.3*angle(X);

k=0.5;
X2=X.*(u(w+pi*k)-u(w-pi*k));
x1=X2*dw*exp(j*w'*n)/(2*pi);  % Compute the inverse Fourier transform

subplot(221);stem(n,x,'.');
grid on;
title('The sequence x[n]');
axis([-20,20,-0.2,1.2])

subplot(222);plot(w/(pi),X1);grid on;
title('The DTFT of sequence x[n]');
%axis([-2,2,-0.2,1.2])

subplot(223);stem(n,x1,'.');
xlabel('Index n');grid on;
axis([-20,20,-0.2,1.2])

subplot(224);
plot(w/(pi),abs(X2),'r');grid on;
xlabel('w[*pi]');
%axis([-2,2,-0.2,1.2])

⌨️ 快捷键说明

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