欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

DFT

程序员文章站 2022-03-19 13:16:50
...

DFT
DFT
DFT
DFT

function [Xk] = dft(xn,N)
% Compute DFT
% Xk = DFT coeff. array over 0<=k<=N-1;
% xn = N-point finite-duration sequence;
% N = Length of DFT
n = [0:1:N-1];
k = [0:1:N-1];
WN = exp(-1j*2*pi/N);
nk = n'*k;
WNnk = WN.^nk;
Xk = xn * WNnk;
end
function [xn] = idft(Xk,N)
% Compute DFS
% Xk = N-point sequence over 0<=k<=N-1;
% xn = One period of periodic signal over 0<=n<=N-1;
% N = length of DFT
n = [0:1:N-1];
k = [0:1:N-1];
WN = exp(-1j*2*pi/N);
nk = n'*k;
WNnk = WN.^(-nk);
xn = (Xk * WNnk)/N;
end
相关标签: 信号