Different results interchanging fftshift and unwrap
Ältere Kommentare anzeigen
I have found that I get very different phase spectra when using FFT without fftshift or unwrap, FFT with fftshift then unwrap, and FFT with unwrap then fftshift. Any ideas as to why and which is correct?
Antworten (1)
Wayne King
am 31 Jul. 2013
Bearbeitet: Wayne King
am 31 Jul. 2013
Hi Bruce, unwrap() works on the vector in order from the 1st element to the last. It stands to reason if you use fftshift first and then call unwrap, you have a different order of phase shifts. unwrap() just looks for jumps of more than pi radians and goes to work, so
unwrap(angle(fft(x)))
and
unwrap(angle(fftshift(fft(x))))
are very likely not going to experience >pi radian shifts in phase at the same elements.
Suppose you have the following 8-point DFT.
xdft = [-3.1344 + 0.0000i
2.3474 - 0.1296i
-0.1774 - 1.5397i
-1.9544 - 0.5292i
-2.4890 + 0.0000i
-1.9544 + 0.5292i
-0.1774 + 1.5397i
2.3474 + 0.1296i]
Then
ang = angle(xdft)
yields:
ang =
3.1416
-0.0552
-1.6855
-2.8772
3.1416
2.8772
1.6855
0.0552
You see that from element 1 to 2, there is more than a pi radian shift, so that
unwrap(ang)
gives you -0.0552+(2*pi) for the 2nd element.
but:
angle(fftshift(xdft))
does not show more than a pi radian jump from element 1 to 2 (because the elements have been reordered), so
unwrap(angle(fftshift(xdft)))
does not affect the 2nd element.
Kategorien
Mehr zu Fourier Analysis and Filtering finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!