image
Physics Forums Logo
image
image
* Register * Upgrade Blogs Library Staff Rules Mark Forums Read
image
image   image
image

Go Back   Physics Forums > Physics > Atomic, Solid State, Comp. Physics


Reply

image Inverse FFT how to scale the x-axis Share It Thread Tools Search this Thread image
Old May20-08, 09:50 AM                  #1
Nasqo

Nasqo is Offline:
Posts: 4
Inverse FFT how to scale the x-axis

Hello
I have a Gaussian Pulse in the frequency domain and transform it with the IFFT into the time-domain. My Problem is now that I can't figure out a way to give the sample points the correct time-scale. What kind of formular do I need to use?
Thank You for helping me!
  Reply With Quote
Old May20-08, 01:50 PM       Last edited by rbj; May20-08 at 01:54 PM..            #2
rbj

rbj is Offline:
Posts: 1,684
i know very little about Atomic and Solid State physics (don't even know what the "Comp." is an abbreviation of), but i know the FFT. the "FFT" is nothing other than a fast or efficient means of computing the DFT (Discrete Fourier Transform). the usual definitions of the DFT and iDFT are

DFT (or FFT):

LaTeX Code:  X[k] \\ = \\ \\sum_{n=0}^{N-1} x[n] e^{-i 2 \\pi n k / N}

and iDFT (or iFFT):

LaTeX Code:  x[n] \\ = \\ \\frac{1}{N} \\sum_{k=0}^{N-1} X[k] e^{i 2 \\pi n k / N}

different implementations put that 1/N in different places, but that is the most common definition.

if your samples x[n]come from a continuous process x(t), then you have to have a sampling period T=1/Fs defined (Fs is the sampling frequency).

LaTeX Code:  x[n] \\equiv x(nT)

the DFT gives you results in the frequency domain that span all frequencies from DC to just under the sampling frequency, Fs.

LaTeX Code:  X[k] = X_{\\mathrm{s}} \\left( \\ \\frac{k}{N} \\ F_{\\mathrm{s}} \\ \\right)

where Xs(f) is the continuous-time Fourier Transform of the sampled signal xs(t) that is zero-padded on both sides.

LaTeX Code:  X_{\\mathrm{s}}(f) = \\int_{-\\infty}^{+\\infty} x_{\\mathrm{s}}(t) e^{-i 2 \\pi f t} dt

and

LaTeX Code:  x_{\\mathrm{s}}(t) =  \\sum_{n=0}^{N-1} x(nT) \\delta(t-nT)

now, because of the Duality Property of the Fourier Transform, you can completely switch around f and t (you might have to replace i with -i), which is what i think you want to do, since you are starting out with frequency-domain data and want to go to time domain. ponder this stuff a little and if you still can't figure it out, i'll get more explicit.
  Reply With Quote
Old May20-08, 02:00 PM       Last edited by Redbelly98; May20-08 at 02:08 PM..            #3
Redbelly98

PF Mentor
 
Redbelly98's Avatar

Redbelly98 is Offline:
Posts: 4,948
Blog Entries: 8
If the frequency data are LaTeX Code: \\Delta f (in Hz, not rad/sec) between adjacent samples, then the time waveform has a duration of

LaTeX Code: <BR>T = \\frac{1}{\\Delta f}

Also,

LaTeX Code: \\Delta t = T/N = \\frac{1}{N \\cdot \\Delta f}

where N is the number of sample points in the time domain.
  Reply With Quote
Old May20-08, 02:05 PM                  #4
rbj

rbj is Offline:
Posts: 1,684
just to be clear of confusion, my T is Redbelly's LaTeX Code: \\Delta t , not the same has his/her T. i s'pose i could change it in my post.
  Reply With Quote
Old May20-08, 02:12 PM                  #5
Redbelly98

PF Mentor
 
Redbelly98's Avatar

Redbelly98 is Offline:
Posts: 4,948
Blog Entries: 8
Hopefully your explanation is enough to clarify things.

Hmmm, my avatar is clearly a male redbellied woodpecker ...
  Reply With Quote
Old May21-08, 05:05 AM                  #6
Nasqo

Nasqo is Offline:
Posts: 4
Originally Posted by Redbelly98 View Post
If the frequency data are LaTeX Code: \\Delta f (in Hz, not rad/sec) between adjacent samples, then the time waveform has a duration of

LaTeX Code: <BR>T = \\frac{1}{\\Delta f}

Also,

LaTeX Code: \\Delta t = T/N = \\frac{1}{N \\cdot \\Delta f}

where N is the number of sample points in the time domain.
Ok I definitely tried that one out, but the Gaussian-Pulse was too narrow! I tried a few different factors and came to the conclusion that the above mentioned factor multiplied with 4.41 gives the best results. But I don't have an explanation for that one. By the way Thank You for replying!
  Reply With Quote
Old May21-08, 05:10 AM                  #7
Nasqo

Nasqo is Offline:
Posts: 4
LaTeX Code: <BR>       X[k] = X_{\\mathrm{s}} \\left( \\ \\frac{k}{N} \\ F_{\\mathrm{s}} \\ \\right) <BR>
What exactly is this Fs in the frequency Domain? Is it the differnce between the ending and starting frequency in my Gaussian-Pulse-Plot? If not that might be the mistake
  Reply With Quote
Old May21-08, 09:31 AM                  #8
rbj

rbj is Offline:
Posts: 1,684
Fs/N is the delta_f that Redbelly speaks of.

so, you start with your Gaussian pulse in the frequency domain. i presume that it corresponds to some spectrum of a real process (or hypothesized real process) in time, right? if time in x(t) is expressed in seconds, then the frequency in X(f) is expressed in Hz. so you must express your Gaussian pulse with its independent variable in Hz. then, to use the FFT, you must sample that Gaussian pulse. also, to use the FFT, you must decide on the number of points, N, which should be large enough to cover the entire pulse way out to the tails of the Gaussian curve, and have the points close enough together so that the pulse is well represented by just those N points. the spacing between samples in the frequency domain is Fs/N. if you know what that spacing is and you know N, then you know what Fs is. then, the transformed data that is in the time domain, represents samples of a continuous-time function where those samples are spaced apart by 1/Fs. if Fs is in Hz, then its reciprocal is in seconds.
  Reply With Quote
Old May21-08, 10:58 AM                  #9
Redbelly98

PF Mentor
 
Redbelly98's Avatar

Redbelly98 is Offline:
Posts: 4,948
Blog Entries: 8
Nasgo,

It might help if you told us what the actual N, frequency spacing, and frequency range (mininum and maximum) are for your data. Please use the time-domain signal to figure N, not the frequency data (see below for explanation.)

Also, there are two possible sources of confusion or error that have occurred to me:

1. Power spectrum vs. amplitude spectrum.
The frequency-domain waveform should be an amplitude spectrum, and not a power spectrum, when you take the inverse fft. What I'm calling the amplitude spectrum is the direct fft of the time-domain signal. Take the square of the absolute value of that, and you get the power spectrum.

The power spectrum is often used in engineering, but is not what one uses to take the inverse fft.


2. The actual range of frequencies in the frequency spectrum.
A real-valued time-domain signal, with spacing LaTeX Code: \\Delta t , produces a complex-valued frequency domain spectrum. This is often displayed in the frequency range between

LaTeX Code: -\\frac{1}{2 \\Delta t} and LaTeX Code: +\\frac{1}{2 \\Delta t}

Since the spectrum in the negative-frequencies are the complex conjugates of the spectrum at positive frequencies, some plotting software might just plot the positive-frequency half of the spectrum. Or it might plot a full spectrum from 0 to 1/dt instead (it's periodic, so no information is lost by doing this).
At any rate, figuring out N from the frequency spectrum, as displayed by your software, might be off by a factor of 2. Getting N from the time-domain signal will remove this possible ambiguity.

I know from past experience that reconciling frequency and time scale values is tricky, as you're finding out, but if you're careful it will work out and make sense.
  Reply With Quote
Old May21-08, 12:23 PM       Last edited by Redbelly98; May21-08 at 12:25 PM..            #10
Redbelly98

PF Mentor
 
Redbelly98's Avatar

Redbelly98 is Offline:
Posts: 4,948
Blog Entries: 8
Originally Posted by Nasqo View Post
Ok I definitely tried that one out, but the Gaussian-Pulse was too narrow! I tried a few different factors and came to the conclusion that the above mentioned factor multiplied with 4.41 gives the best results. But I don't have an explanation for that one. By the way Thank You for replying!
With Gaussian's, it's both easy to calculate and easy to mess up calculating the width in the time and frequency domains.

The rms half-widths (or equivalently, the half-width at 60% of maximum) will be reciprocals of each other in the time and angular frequency (rad/sec) domains. This is the parameter LaTeX Code: \\sigma in the expression,

LaTeX Code: f(x) = e^{\\left(\\frac{-x^2}{2 \\sigma^2}\\right)}

Among the ways to get things wrong are:
Using Hz instead of rad/sec for the frequency-domain rms half-width
Using the full-width-at-half-maximum instead of the rms half-width
Using a power spectrum, instead of the actual FT, in the frequency domain

So the correct time-domain width is given by

LaTeX Code: <BR>\\sigma_{time} = \\frac{1}{\\sigma_{rad}}= \\frac{1}{2 \\ \\pi \\ \\sigma_{Hz}}<BR>

where sigma is taken between the pulse maximum and 0.60 [=e^(-1/2)] of the maximum.

Hope this helps!
  Reply With Quote
Old May21-08, 12:53 PM                  #11
rbj

rbj is Offline:
Posts: 1,684
Originally Posted by Redbelly98 View Post
It might help if you told us what the actual N, frequency spacing, and frequency range (mininum and maximum) are for your data.
remember that the three parameters are related. you can specify two of the three sorta independently, but the the value of the third is a consequence of the values of the other two.

Please use the time-domain signal to figure N, not the frequency data (see below for explanation.)
but he doesn't know the time-domain signal yet.

one thing, to sorta help how this will sort out, is that theoretically, the continuous Fourier Transform of a gaussian pulse is a gaussian pulse.

if we define the F.T. as electrical engineers like to:

LaTeX Code:  X(f) \\equiv \\mathcal{F} \\left\\{ x(t) \\right\\} \\equiv \\int_{-\\infty}^{+\\infty} x(t) e^{-i 2 \\pi f t} dt

with the resulting inverse F.T.:

LaTeX Code:  x(t) \\equiv \\mathcal{F}^{-1} \\left\\{ X(f) \\right\\} = \\int_{-\\infty}^{+\\infty} X(f) e^{i 2 \\pi f t} df

then the F.T. of the unit gaussian pulse (centered at zero) is:

LaTeX Code:  \\mathcal{F} \\left\\{ e^{-\\pi t^2} \\right\\} = e^{-\\pi f^2}

we EEs commit that to memory (along with the scaling and translation theorems of the F.T.) and we can do any gaussian pulse centered at any time or frequency, with even imaginary parts which happens when one examines a linearly-swept frequency "chirp}" signal. a gaussian windowed chirp is just a gaussian, with the right subsitution of scalers and if one "completes the square" in the exponent.

even though i am not suggesting to the OP to not do the FFT and use the theoretical F.T., the OP should know what to expect coming out of FFT (or iFFT, in this case), because if it is radically different, the range or spacing or size of N is not good enough. the FFT should approximate the theoretical F.T. if one sets it up correctly.
  Reply With Quote
Old May21-08, 03:38 PM                  #12
Redbelly98

PF Mentor
 
Redbelly98's Avatar

Redbelly98 is Offline:
Posts: 4,948
Blog Entries: 8
Originally Posted by Redbelly98
Please use the time-domain signal to figure N, not the frequency data ...
Originally Posted by rbj View Post
but he doesn't know the time-domain signal yet.
I thought he just doesn't know how to scale his time-domain signal. He has the waveform, and N is the one thing he does know about it.

Another thought I just had, for a simpler test than using a Gaussian. Take a spectrum that contains just one known frequency, i.e. it's zero everywhere except at this one frequency. Inverse transform that and you have a sinusoid of known period, and the time scale is easily extracted from that.

As I mentioned in another post, using a Gaussian it's not hard to miscalculate things. A sinusoid (in the time domain) should be a true no-brainer!

Regards,

Mark
  Reply With Quote
Old May21-08, 05:29 PM                  #13
rbj

rbj is Offline:
Posts: 1,684
using your semantics, i thought the OP had a gaussian pulse in the frequency domain, he was sampling it with N points each spaced from their adjacent neighbor by LaTeX Code: \\Delta f . we know that the spacing of the time-domain points will be LaTeX Code:  \\Delta t = 1/(N \\Delta f)  .
  Reply With Quote
Old May22-08, 08:07 AM                  #14
Redbelly98

PF Mentor
 
Redbelly98's Avatar

Redbelly98 is Offline:
Posts: 4,948
Blog Entries: 8
Originally Posted by rbj View Post
using your semantics, i thought the OP had a gaussian pulse in the frequency domain, he was sampling it with N points each spaced from their adjacent neighbor by LaTeX Code: \\Delta f . we know that the spacing of the time-domain points will be LaTeX Code:  \\Delta t = 1/(N \\Delta f)  .
Yes, true. But the OP was puzzled why the time-domain Gaussian's width did not match what he thought it should be. My point is that it's easy to miscalculate that width, so I suggested trying a pure sine wave to convince himself that the scaling formula you and I have agreed on really works.
  Reply With Quote
Old May28-08, 08:35 AM                  #15
Nasqo

Nasqo is Offline:
Posts: 4
Thanks very much!
You were right! It was a problem with measuring the Pulse-width and additionally the input signal into the iFFT wasn't in Hz. I'm really happy that this is working now, thanks again for the good advice!
  Reply With Quote
Old May28-08, 09:30 AM                  #16
Redbelly98

PF Mentor
 
Redbelly98's Avatar

Redbelly98 is Offline:
Posts: 4,948
Blog Entries: 8
Only reason I know this is from making the same mistakes myself!
  Reply With Quote
image image
Reply
Thread Tools


Similar Threads for: Inverse FFT how to scale the x-axis
Thread Thread Starter Forum Replies Last Post
Difficulty with washer method when revolving around axis other than y or x axis. bah Calculus & Beyond 2 Sep11-07 12:13 AM
Having troubles showing A has no inverse or finding the inverse, matrices. mr_coffee Introductory Physics 0 Oct4-05 05:46 PM
On a scale from 1-10 Mwyn Beyond the Standard Model 89 Jun4-05 03:24 AM
compactification scale versus decompactification scale jakks Beyond the Standard Model 0 Sep20-04 11:56 AM
Re: Higgs Particles & Scale-Invariant Metrics & Breaking Scale Symmetry Alfred Einstead General Physics 4 May18-04 04:44 PM

Powered by vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd. © 2009 Physics Forums
Sciam | physorgPhysorg.com Science News Partner
image
image   image