Re: phase of fft on matlab
- From: dbell <bellda2005@xxxxxxx>
- Date: Mon, 17 Mar 2008 11:39:15 -0700 (PDT)
On Mar 17, 1:44 pm, "mariauld" <marius.pel...@xxxxxxxxxxxxxxxxxx>
wrote:
Hi,
first I'd like to thank you all, Bharat, Kamar, Manolis, Dirk, for your
useful help.
Bharat, your idea of cleaning up the numbers close to zero
helped me to avoid noise effects.
I associated this with the idea of Dirk, using fftshift on vector x.
This leads me to good results:
x1 = -0.6:0.001:0.6;
x = ifftshift(x1);
testx = exp(-((50*x).^2));
tftestxinit = fft(testx);
tftestx = fftshift(tftestxinit);
%---------------------------- code modification start
hz = tftestx;
hzr = real(tftestx);
hzi = imag(tftestx);
index = find(abs(hzr) < 1e-10);
hzr(index) = 0;
index = find(abs(hzi) < 1e-10);
hzi(index) = 0;
tftestm = complex(hzr, hzi);
%---------------------------------- code modification ended
abstftestx = abs(tftestm);
angletftestx = angle(tftestm);
f = 1000*(-600:600)/1201;
figure;plot(f,abstftestx)
title('absolute frequency content of testx')
xlabel('f (1/m)')
ylabel('magnitude of the dft')
figure;plot(f,angletftestx)
title('angular frequency content of testx')
xlabel('f (1/m)')
ylabel('phase of the dft')
Thank you all again
I just realized I don't have time tonight. So here are a few things to
consider:
1)you need to take off one sample to make the FFT input "implied
symmetric" if you are going to ideally expect all real FFT output
results.
2)real output results does not have to mean zero phase. If the number
is positive, then it has zero phase. If the number is negative, the
phase is +-pi, whatever your phase function returns for a negative
number.
3)what you are taking the FFT of is a rectangularly windowed
gaussian. The output of the FFT will be close to gaussian over some
range, but not gaussian.
4)the FFT output magnitude decreases at a very fast rate. If you plot
it on a log scale you will see that at some point the magnitude
noticably ceases to be gaussian.
5)the phase is only close to what you expect for gaussian when the
magnitude is close to gaussian.
6)setting the small values to zero gives a phase of 0 in the matlab
atan2 function. This generally is not a correct thing to do since you
rarely have reason to believe the phase should be zero. However, it
may be a useable thing to do.
7)with the gaussian pulse generated centered in the FFT window, but
operated on by fftshift prior to the fft the phases are approx 0 where
the output magnitude is close to gaussian.
8)with the gaussian pulse in the center of the FFT window, the phases
where the magnitude is close to gaussian generally alternate between
approx 0 and +-pi (one or both), where the output magnitude is close
to gaussian. The phases are not all 0.
9) When the fft output magnitude ceases to be close to gaussian
(flattens out on log scale), the phase is pretty random, not always 0.
Hope that helps,
Dirk
.
- References:
- phase of fft on matlab
- From: mariauld
- Re: phase of fft on matlab
- From: dbell
- Re: phase of fft on matlab
- From: mariauld
- phase of fft on matlab
- Prev by Date: Re: Breakthrough in noise reduction?
- Next by Date: Re: Opinions on "Multirate Signal Processing..." by F.J.Harris?
- Previous by thread: Re: phase of fft on matlab
- Next by thread: Fixed pt vs Floating pt for speed
- Index(es):
Relevant Pages
|
Loading