oscillating phases when using fft and ifft
17 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
Cindy Solomon
2015-5-6
编辑:Cindy Solomon
2015-5-6
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 个评论
另请参阅
类别
在 Help Center 和 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!