1
$\begingroup$

I have an oscillating pulse in the frequency domain that I would like to inverse Fourier transform. My signal looks like: Frequency domain signal

Which was coded in MATLAB using the following code:

sampleRate = 1000;
freq = 500 : (1/sampleRate) : 1500;
intensityFreq = exp(-((freq-1000).^2));
signalFreq = sqrt(intensityFreq).*exp(-1i*10*(freq-1000));
plot(freq,signalFreq)

When I inverse Fourier transform, it shows a similar oscillating pulse (in time) whose oscillations depends on the frequency range I used in the above code. For example, when:

freq = 500 : (1/sampleRate) : 1500;

is used (as in the code shown above), the inverse fourier transform looks like: Time domain IFFT output with large frequency window and thus high frequency oscillation

But when:

freq = 980 : (1/sampleRate) : 1020;

Is used instead, the inverse Fourier transform looks like: Time domain IFFT output with small frequency window and thus low frequency oscillation

This makes no sense to me, since the frequency range shouldn't matter since signalFreq goes to 0 around these points anyway. Why does the altered frequency range affect the oscillations in the inverse Fourier transform so much? How do I obtain the "actual" time domain signal that doesn't depend on frequency windows?

Any help is much appreciated. If this post is not clear I would be happy to provide more detail.

EDIT: The full code used to find the inverse Fourier transform is:

sampleRate = 1000;
freq = 500 : (1/sampleRate) : 1500;
intensityFreq = exp(-((freq-1000).^2));
signalFreq = sqrt(intensityFreq).*exp(-1i*10*(freq-1000));
Y = ifft(signalFreq);
plot(real(Y))
$\endgroup$
  • $\begingroup$ How do you calculate the inverse Fourier transform? Your two frequency vectors have different length and neither one covers the entire range required for an inverse Fourier transform. $\endgroup$ – Hilmar Jan 9 at 14:17
  • $\begingroup$ @Hilmar, I attached the code I used to generate the inverse Fourier transform to the post. There is a range required for an inverse Fourier transform? $\endgroup$ – dljs Jan 9 at 23:23
  • $\begingroup$ Of course the IFFT requires a full spectrum (even if it's zeros). Look at the definition. $\endgroup$ – Hilmar Jan 10 at 12:54
1
$\begingroup$

ifft works on the full spectrum as pointed by Hilmar. In the discrete description of Fourier Transform theory, it means that each sample supplied as the argument to ifft is a frequency bin in the range $[0,1]$ in cycles per sample (see normalized frequency if you do not know what that means), which corresponds to $[0,2\pi]$ radians per sample or $[0, F_s]$ sample per second.

Basically what ifft saw is a spectrum ranging from (assuming $F_s=1000 Hz$, which as you see below is completely arbitrary):

  • 0 to 1000 Hz in the first case, with a Gaussian in magnitude spectrum around 500 Hz
  • 0 to 40 Hz in the second case, with a Gaussian in magnitude spectrum around 20 Hz

Although it gets a bit more tricky, as your Gaussian is peaking right at the Nyquist frequency, you are simply retrieving an oscillation in time-domain at the limit of your sampling rate. In both case your spectrum is the same shape but only of different length, if you assume the signal is of fixed duration that means you are transforming two signals with different sampling frequency.

It would be more appropriate to define first the frequency range as

sampleRate = 1000;
duration = 1; % 1 second
N = duration * sampleRate;
delta_f = N/sampleRate; % frequency resolution: this is fixed by all other parameters
freqs = 0:delta_f:sampleRate

% Then create your gaussian spectrum around whatever value (but below Nyquist!)
mu = 250;
sigma = 50;
intensityFreq = exp(-(freqs-mu).^2/sigma);
% etc... Play around with mu, center frequency of your gaussian, and sigma.

All in all, I would advise you to read a bit more about discrete Fourier transform and inverse Fourier transform.

Also, from your example code you will get a complex valued time-domain signal. If you were aiming for a real-valued signal, of course the magnitude spectrum supplied must be symmetric around the Nyquist frequency $Fs/2$ (and more precisely the complex valued spectrum must be complex conjugate). But this is another matter, and you should read more about Fourier transform theory if this is unknown to you (this answer is a good read on the matter).

% To transform the complex spectrum such that the second half is the complex conjugate of the first (avoiding DC 0th bin) do:
signalFreq = sqrt(intensityFreq)*exp(1i*freqs); % assuming intensityFreq is defined on one half only, 0 on range [fs/2:fs]
signalFreq(end-1:-1:end/2+1) = conj(signalFreq(2:end/2));

% You can use the option 'symmetric' to assume that the argument is conjugate symmetric:
signalTime = ifft(signalFreq, 'symmetric');
```
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.