oscillating phases when using fft and ifft
17 views (last 30 days)
Show older comments
Hi,
I noticed that I get oscillations in the phases of the fourier transform of my gaussian function and also in the inverse transform of the transform, this is illustrated in the following code:
tm=10*10^-4; dt=10^-6; t=-tm:dt:tm; t0=3*10^-5; lt=length(t); f=(-lt/2:lt/2-1)*1/(lt*dt); y=exp(-t.^2/t0.^2); ft=fftshift(fft(ifftshift(y))); y2=ifftshift(ifft(fftshift(ft)));
figure subplot(3,2,1); plot(t,y); title('Initial time profile') subplot(3,2,2); plot(t,phase(y)); title('Initial time phase'); subplot(3,2,3); plot(f,abs(ft)); title('Fourier transform, magnitude') subplot(3,2,4); plot(f,unwrap(phase(ft))); title('Fourier transform, phase') subplot(3,2,5); plot(t,abs(y2)); title('Second time profile') subplot(3,2,6); plot(t,unwrap(phase(y2))); title('Second time phase')
I'm wondering if there's any way to get rid of these or if I need to use some sort of filter? In my real program, I need to be able to affect the spectral content of the fourier transform before I invert it back to time space.
Thanks in advance Robert
0 Comments
Answers (2)
Cindy Solomon
on 6 May 2015
Edited: Cindy Solomon
on 6 May 2015
Hi Robert,
Is there a reason you're defining ft and y2 by first performing fftshift or ifftshift on those signals? These functions are intended to shift the zero-frequency component to the center of the spectrum. For example, you would use fftshift after FFT if you want to center the plot and view it as a 2-sided spectrum with the axis -Fs/2 to +Fs/2.
In addition, the values that you are calculating are not symmetric, which leads to phase offsets. A signal with non-zero phase means that your frequency amplitudes will oscillate.
Hope this helps!
0 Comments
See Also
Categories
Find more on Fourier Analysis and Filtering 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!