Problem with ifftn and ifftshift??

조회 수: 5 (최근 30일)
Bran
Bran 2013년 6월 26일
댓글: Walter Roberson 2023년 10월 14일
Hi there I was wondering if someone could help me. I am using the fftn fftshift functions as part of my alogrithm;
tmp = fftn(MAT); Adash = fftshift(tmp);
Adashup=ifftshift(Adash);
Adashup2new = ifftn(Adashup);
However, When I took everything else out and left these in as a tester I noticed that instead of the above taking me back to the original MAT, it alters the numbers quite a lot. What am I doing wrong?? Example original file MAT has a min of 0 and a max of 1.0856, however the file Adashup2new has a min of -6.792 and a max of 1.0856
  댓글 수: 2
Mehri Mehrnia
Mehri Mehrnia 2023년 10월 14일
why we should use fftshit?when I dont use fftshit, scale is good and untouched
Walter Roberson
Walter Roberson 2023년 10월 14일
fft() returns back the 2-sided fft. By convention, the order of frequency bins returns back from fft() of real input signals is like
0, 1, 2, 3, 4, ... n-1, n, conj(-n), conj(-(n-1)), ... conj(-(4)), conj(-(3)), conj(-(2)), conj(-1)
but people often prefer to visualize it in the order
conj(-(n-1)), ... conj(-(4)), conj(-(3)), conj(-(2)), conj(-1), 0, 1, 2, 3, 4, ... n-1, n
The change is not mathematically significant: it is just easier for people to look at the plots.

댓글을 달려면 로그인하십시오.

채택된 답변

Nitin
Nitin 2013년 6월 26일
Sounds like Imaginary components are there due to round off errors, try extracting the real part
f = real(ifft2(F));

추가 답변 (1개)

Bran
Bran 2013년 6월 27일
Thanks so much for the help! I will try your suggestion! :D

카테고리

Help CenterFile 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