Inverse FFT how to scale the x-axis

In summary, the conversation discusses the use of the IFFT to transform a Gaussian Pulse from the frequency domain to the time-domain. There is a question about how to give the sample points the correct time-scale and the conversation delves into the formula for the DFT and iDFT, as well as the sampling period and frequency. There is also discussion about the difference between power spectrum and amplitude spectrum and the possible ambiguity in determining N from the frequency spectrum.
  • #1
Nasqo
4
0
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 formula do I need to use?
Thank You for helping me!
 
Physics news on Phys.org
  • #2
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):

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

and iDFT (or iFFT):

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

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).

[tex] x[n] \equiv x(nT) [/tex]

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

[tex] X[k] = X_{\mathrm{s}} \left( \ \frac{k}{N} \ F_{\mathrm{s}} \ \right) [/tex]

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

[tex] X_{\mathrm{s}}(f) = \int_{-\infty}^{+\infty} x_{\mathrm{s}}(t) e^{-i 2 \pi f t} dt [/tex]

and

[tex] x_{\mathrm{s}}(t) = \sum_{n=0}^{N-1} x(nT) \delta(t-nT) [/tex]

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.
 
Last edited:
  • #3
If the frequency data are [tex]\Delta f[/tex] (in Hz, not rad/sec) between adjacent samples, then the time waveform has a duration of

[tex]
T = \frac{1}{\Delta f}[/tex]

Also,

[tex]\Delta t = T/N = \frac{1}{N \cdot \Delta f}[/tex]

where N is the number of sample points in the time domain.
 
Last edited:
  • #4
just to be clear of confusion, my T is Redbelly's [itex]\Delta t[/itex], not the same has his/her T. i s'pose i could change it in my post.
 
  • #5
Hopefully your explanation is enough to clarify things.

Hmmm, my avatar is clearly a male redbellied woodpecker ... :biggrin:
 
  • #6
Redbelly98 said:
If the frequency data are [tex]\Delta f[/tex] (in Hz, not rad/sec) between adjacent samples, then the time waveform has a duration of

[tex]
T = \frac{1}{\Delta f}[/tex]

Also,

[tex]\Delta t = T/N = \frac{1}{N \cdot \Delta f}[/tex]

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!
 
  • #7
[tex]
X[k] = X_{\mathrm{s}} \left( \ \frac{k}{N} \ F_{\mathrm{s}} \ \right)
[/tex]
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
 
  • #8
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.
 
  • #9
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 [tex]\Delta t[/tex], produces a complex-valued frequency domain spectrum. This is often displayed in the frequency range between

[tex]-\frac{1}{2 \Delta t}[/tex] and [tex]+\frac{1}{2 \Delta t}[/tex]

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.
 
  • #10
Nasqo said:
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 [tex]\sigma[/tex] in the expression,

[tex]f(x) = e^{\left(\frac{-x^2}{2 \sigma^2}\right)} [/tex]

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

[tex]
\sigma_{time} = \frac{1}{\sigma_{rad}}= \frac{1}{2 \ \pi \ \sigma_{Hz}}
[/tex]

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

Hope this helps!
 
Last edited:
  • #11
Redbelly98 said:
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 sort of 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 sort of 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:

[tex] X(f) \equiv \mathcal{F} \left\{ x(t) \right\} \equiv \int_{-\infty}^{+\infty} x(t) e^{-i 2 \pi f t} dt [/tex]

with the resulting inverse F.T.:

[tex] x(t) \equiv \mathcal{F}^{-1} \left\{ X(f) \right\} = \int_{-\infty}^{+\infty} X(f) e^{i 2 \pi f t} df [/tex]

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

[tex] \mathcal{F} \left\{ e^{-\pi t^2} \right\} = e^{-\pi f^2} [/tex]

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.
 
  • #12
Redbelly98 said:
Please use the time-domain signal to figure N, not the frequency data ...

rbj said:
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
 
  • #13
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 [itex]\Delta f[/itex]. we know that the spacing of the time-domain points will be [itex] \Delta t = 1/(N \Delta f) [/itex].
 
  • #14
rbj said:
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 [itex]\Delta f[/itex]. we know that the spacing of the time-domain points will be [itex] \Delta t = 1/(N \Delta f) [/itex].

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.
 
  • #15
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!
 
  • #16
Only reason I know this is from making the same mistakes myself! :smile:
 

1. What is an Inverse FFT?

An Inverse Fast Fourier Transform (FFT) is a mathematical algorithm used to convert frequency domain data into a time domain signal. It is the opposite of a regular FFT, which converts time domain data into the frequency domain.

2. How do you scale the x-axis in an Inverse FFT?

The x-axis of an Inverse FFT represents time and is usually scaled in seconds. To scale the x-axis, you can use the sampling frequency (Fs) and the length of the input signal (N) to calculate the time interval between each data point, which is given by 1/Fs*N. You can then label the x-axis accordingly.

3. Why is scaling the x-axis important in an Inverse FFT?

Scaling the x-axis in an Inverse FFT is important because it allows us to interpret the time domain signal accurately. Without proper scaling, the time axis may not align with the original data or may be distorted, making it difficult to analyze the signal.

4. Can you manually adjust the x-axis scale in an Inverse FFT?

Yes, you can manually adjust the x-axis scale in an Inverse FFT by changing the time interval between data points. This can be done by changing the sampling frequency or the length of the input signal. However, it is important to ensure that the scaling is accurate to avoid any misinterpretation of the data.

5. Is there a difference between scaling the x-axis in a regular FFT and an Inverse FFT?

Yes, there is a difference in scaling the x-axis in a regular FFT and an Inverse FFT. In a regular FFT, the x-axis represents frequency and is typically scaled in Hertz. In an Inverse FFT, the x-axis represents time and is usually scaled in seconds. Additionally, the scaling of the x-axis in an Inverse FFT is dependent on the sampling frequency and the length of the input signal, whereas in a regular FFT, the scaling is determined by the frequency resolution of the signal.

Similar threads

Replies
6
Views
976
Replies
2
Views
2K
  • Differential Equations
Replies
11
Views
2K
Replies
26
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
745
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
  • Atomic and Condensed Matter
Replies
12
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • Electrical Engineering
Replies
1
Views
932
Back
Top