fft definition in matlab doc puzzling
Show older comments
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 Comments
Walter Roberson
on 17 Feb 2019
?? I do not see the word "projection" at all in that documentation ??
françois anquez
on 19 Feb 2019
Accepted Answer
More Answers (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 Comments
françois anquez
on 21 Feb 2019
françois anquez
on 21 Feb 2019
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
Categories
Find more on Graphics Object Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

