Why is DFT phase different from FFT phase?

If I compute the DFT using the definition given on Wikipedia, real components relate directly to cosine amplitudes and imaginary components relate directly to sine amplitudes.
I.e.
dft(sin(t))= [0, 0-0.5i, 0, 0, 0, 0, 0, 0+0.5i]
where
t=linspace(2*pi/8,2*pi,8);
but using the fft function:
fft(sin(t))/8= [0, 0.3536-0.3536i, 0, 0, 0, 0, 0, 0.3536+0.3536i]
The magnitudes are equal but I can no longer seperate sine and cosine components with FFT. Is there any way I can pre-treat my data so I can use FFT to give the same outputs as DFT?

 采纳的回答

The DFT is a linear operator from \mathbb{C}^N to \mathbb{C}^N.
Your vector sin(t) for the argument values you have defined is
0.7071
1.0000
0.7071
0.0000
-0.7071
-1.0000
-0.7071
-0.0000
The 2nd element of the DFT is equal to inner product of your vector and
W = exp(1i*(2*pi)/8*(0:7)');
So
X = [ 0.7071
1.0000
0.7071
0.0000
-0.7071
-1.0000
-0.7071
-0.0000];
dot(W,X)
Why do you expect any other result? The output of fft() matches exactly what you would expect from the DFT (given the definition used in MATLAB).

1 个评论

Aaaahhhh yes, I knew something wasn't right. I had used
W=exp(1i*(2*pi)/8*(1:8)');
and it matched up perfectly because I was using
t=linspace(2*pi/8,2*pi,8);
when I should have been using
t=linspace(0,2*pi-2*pi/8,8);
A basis of slightly shifted sine waves to match up to my slightly shifted sine wave. To be fair, I should have probably waited until morning before posting the question.
Thanks for the help, I can sleep happy now

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by