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

📄 dft.m

📁 经典《信号与系统》教程的matlab例程,对深入理解信号与系统相关概念有很大帮助
💻 M
字号:


N=input('Type in the period N:');
M=input('Type in the length M:');
n=-N:2*N;
x=(u(n)-u(n-M));
xs=(u(n+N)-u(n-M+N))+(u(n)-u(n-M))+(u(n-N)-u(n-M-N))+(u(n-2*N)-u(n-M-2*N));
subplot(221)
stem(n,x,'.')
title('The curve of sequence x(n)')
%xlabel('Index n')
%ylabel('The amplitude of x(n)')
subplot(223)
stem(n,xs,'.')
title('The periodic sequence xs(n) from x(n)')
xlabel('Index n')
%ylabel('The amplitude of xs(n)')
k=0:N;
w1=2*pi/N;
w=k*w1;
F=x*exp(-j*n'*w);
subplot(224)
stem(k,abs(F),'r.')
axis([0,N,0,max(abs(F))])
xlabel('Index w')
title('The DFT of x(n)')

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

F=x*exp(-j*n'*W);                  
F1=abs(F);                           
                     
subplot(2,2,2);plot(k/(2*N),F1);

title('The DTFT of x(n) ');

⌨️ 快捷键说明

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