FFT on dim > 1 returning negative values?

I have a matrix that's [NxT] and I want the fft over the second dimension. But if I do this:
X = rand(100,200);
F1 = fft(X,[],2);
F2 = fft(X')';
figure;
subplot(2,1,1);
plot(real(F2)-real(F1));
subplot(2,1,2);
plot(imag(F2)-imag(F1));
Then, you can see, imag(F1) = -imag(F2). That is, F1 = conj(F2)
Is this a bug or am I misunderstanding something?

 채택된 답변

Sean de Wolski
Sean de Wolski 2012년 4월 18일

0 개 추천

This is caused because you are taking the complex conjugate transpose ('). If you take the regular transpose (.') you will see the behavior you are expecting:
X = rand(100,200);
F1 = fft(X,[],2);
F2 = fft(X.').'; %note the .'
figure;
subplot(2,1,1);
plot(real(F2)-real(F1));
subplot(2,1,2);
plot(imag(F2)-imag(F1));
And for more info:
doc ctranspose %complex conjugate transpose
doc transpose %regular one

추가 답변 (1개)

Keith
Keith 2012년 4월 18일

0 개 추천

Whooooooooooooooooooooooooa. I did NOT know that! I've been using it for years. You seriously just blew my mind.
Now I get to go spend the next year going through all of my code.
Thanks so much for setting me straight!

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

질문:

2012년 4월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by