fft definition in matlab doc puzzling
显示 更早的评论
Hi all,
I'm a bit puzzled with the definition of fft in the documentation :
The definition at the very end in "more about" states the fft as a projection on positive frequency (from 0 to Fs/N) while the examples suggest a "two sided" spectrum ie. with positive frequencies and negative ones (-Fs/2 to Fs/2).
To make my question more precise :
the definition in the doc is :
Given that the fft results in both positive and negative frequencies, I woumld have guess a defintion like :

Am I missing something ?
thanks in advance for your help,
Francois.
2 个评论
Walter Roberson
2019-2-17
?? I do not see the word "projection" at all in that documentation ??
françois anquez
2019-2-19
采纳的回答
更多回答(1 个)
Your second definition only makes sense if you define the indexing in Y(k) to be modulo-n. Otherwise, it is not clear what it means for a vector Y to be indexed at negative k.
If you are defining Y(k) to be modulo n, then the two IFFT definitions are equivalent because Y(k) and W_n(j-1)(k-1) are then both n-periodic with respect to k. Therefore any sum over n successive indices k gives the same result.
4 个评论
françois anquez
2019-2-21
françois anquez
2019-2-21
The test code should be as below. The main problem with your implementation is that in the first version of the coefficient calculation, you are putting the time origin at X(1) whereas in the second version, you are putting the time origin at X(N/2). Thus, the second version is really the transform of a phase-shifted version of X.
function [coef1,coef2]=essaiFFT_Matt(X,k)
N=numel(X);
WN=exp(-1i*2*pi/N);
coef1=0;
for j=1:N
coef1=coef1+X(j)*power(WN,(j-1)*(k-1));
end
coef2=0;
for j=(1:N) - floor(N/2) %floor() handles odd N
index=mod(j-1,N)+1; %modulo N transform for 1-based indexing
coef2=coef2 + X(index)*power(WN,(j-1)*(k-1));
end % for jj
end % function
类别
在 帮助中心 和 File Exchange 中查找有关 Waveform Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


