?? dft_dir.m
字號(hào):
% Name:DFT_dir
% The direct algorithm
N=input('Type in the DFT length N=');
n=0:N-1;
x=input('x(n)=:');%u(n)-u(n-4);%input('Type in the sequence x(n)=');
k=0:N-1;
X=zeros(1,N);
for m=0:N-1;
for j=0:N-1;
X(m+1)=X(m+1)+x(j+1).*exp(-i*2*pi*m*j/N);
end
end
subplot(211)
stem(n,x,'.')
axis([0,N,-0.2*max(x),1.2*max(x)])
title('The original sequence x(n)')
xlabel('Index n')
subplot(212)
stem(k,abs(X),'r.')
axis([0,N,-0.2*max(abs(X)),1.2*max(abs(X))])
title('The DFT of the seqence x(n)')
xlabel('Index k')
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -