03-22-2010 10:35 AM
In order to understand how FFT approximates the continuous-time fourier transform, I did this exercise.
I took the signal x(t) = exp(-t), t >=0.
Theory tells me that its Fourier transform is
X(f) = 1/(1+j*2*pi*f)
thus the amplitude spectrum is
1/sqrt(1+(2*pi*f)^2)
and the phase spectrum is
-atan(2*pi*f).
In the attached VI, just for fun, I plotted X(f) in 3 ways:
Amplitude is always the same.
As for phase, Points 2 and 3 give exactly the same result, which is different from point 1.
I know this is more of a math-related problem rather than a LabVIEW-related one, but I'm really curious about it and maybe somebody has the answer?
03-22-2010 11:48 AM
03-22-2010 12:17 PM - edited 03-22-2010 12:21 PM
Hi Darin, thanks for the reply but I don't think it fits, for 4 reasons:
I think you haven't looked at the attached example so I'm putting a picture, this time (it's quicker to look at): http://img707.imageshack.us/img707/6245/fftdoubt.png
Basically, the phase computed by the FFT is always sloped. Its analytical counterpart is not. What do you guys think?
03-22-2010 05:30 PM
Ale83 wrote:Hi Darin, thanks for the reply but I don't think it fits, for 4 reasons:
- Why is the amplitude perfectly approximated and only the phase is not?
- The domain of my signal is taken in a way that "it is practically zero" outside of its domain (exp(-t) for t>= 14 is 1E-6 or less)
- I did the same exercise for a finite-time signal and there was the same phase problem.
- According to your explanation, the longer the time-signal domain, the better the approximation. But nothing changes (I tried that out.)
I think you haven't looked at the attached example so I'm putting a picture, this time (it's quicker to look at): http://img707.imageshack.us/img707/6245/fftdoubt.png
Although it was not necessary I did look at the example program and I do not have Mathscript as of LV9. I could tell from your description that you did not fully understand the difference between the Discrete Time FT (as approximated by the FFT) and the continuous time FFT. If you were to generate the continuous time analog of your sampled signal you will find that after you sample, window and periodically extend the signal that your results should match. Your textbook should describe this process.
In your simple case, you do not even need the FFT to find the DTFT. If you write out the sum, you will find a geometric series, here is the result I get for the DTFT, you can test on your data and if you find the result matches the FFT result then you know the FFT is doing its job (which is to approximate the DTFT). No guarantees against math errors since this is back of the envelope.
As to question #1, the fact that the results match at f=0 are most likely a vindication of Parseval's theorem. As you see, it doesn't match at other frequencies. 2,3,4 are all explained by periodic extension.
03-28-2010 05:00 PM
Thank you for the answer, Darin. You are right that the periodic extension is key and I tried to sort out things from that perspective and it explains many things. However I still can't get the result I'd expect from applying the textbook stuff. Maybe I'm still missing something. This is what I think I should get:
Continuous time signal: x(t) = exp(-t), t>=0 ---> Theory tells me that X(f) = 1/(1+j*2*pi*f)
Sampled signal: p[n] = x(nT) = exp(-nT), n = 0, 1, 2, ... ---> Theory tells me that P(f) = 1/(1-exp(-j*2*pi*f*T-1))
As far as I understand, since sampling in time -> periodicization in frequency, it should be true that P(f) = (1/T) * sum_k X(f - k/T) but it is not the case, if I try to plot in amplitude and phase the two ways of obtaining P(f).What am I doing wrong?
04-01-2010 03:04 PM
Sorry, as for the sampled signal transform there was a little mistake in my last post. Here's the correct form
Sampled signal: p[n] = x(nT) = exp(-nT), n = 0, 1, 2, ... ---> Theory tells me that P(f) = 1/(1-exp(-j*2*pi*f*T-T))
The quantity P(f) = (1/T) * sum_k X(f - k/T) is true concerning amplitude spectra, but slightly different concerning phase spectra.
If I check it in terms of real and imaginary part, they seem to agree very well.
11-09-2011 08:10 AM
I meet the same problem like you .But even I use fft.vi and take the signal x(t) =exp(-t), t>=0 ,I find the phase
spectrum is still different from theory.If you replace the signal x(t) =exp(-t) into gauss pulse f(t)=exp(-(t/a)^2),
you will find the result is the same ,the phase spectrum is also different from theory.Do you find answer now?
11-09-2011 08:59 AM
yes, I figured that out. Here's the thing:
You have your continous time signal x(t), ok? Great. Then you sample it and get a sequence x[n].
They key point is, in that sequence the sampling-time information is lost. Samples are spaced by a dimensionless unit (x[0], x[1], x[2], ....).
DTFT doesnt care what the sampling time is. That will be your business, but later!
Let's have a look at our example. You have exp(-t) and sample it to get exp[-n]. Its DTFT is X(w) = 1/(1-exp (-1-j*w) ) where w is the "dimensionless" frequency, it is in radians, not Hz, and its base period is [-pi, pi]
The phase of X(w) in theory is exactly what the FFT.vi plots.
Don't forget that FFT is only a way of implementing DTFT, but they are the same thing 🙂
The "actual" frequency in Hertz will be W = w/T, where T is your original sampling time. It simply de-normalizes the w axis and gives it a unit of measurement. It is nothing more than a rescaling, the spectrum shape (amplitude and phase) does not change.
Clear?
11-09-2011 09:09 AM
My point is, the phase spectrum of your continous-time signal and the phase spectrum of your sampled signal already ARE different.
The FFT.vi is an implementation of that and shows nothing else than the theory behind it.
12-11-2019 05:21 AM
Hello,
Could you please explain it again I do not get your point.
I have also a similar problem that the magnitude in the amplitude spectra delivers pretty accurate results and the phase from the phase spectra shows me wrong values by using an FFT of an incoming square signal and I don´t know why.
Best regards
Alex