my question is quite straight-forward to be grasped and handled.

I have an 1D array, F_11 representing a target power spectrum. It is sketched in the following figure

enter image description here

Then, I start generating a time series u which embodies the properties of F_11, as follows

nn = complex(normrnd(0,1,[1,1000]),normrnd(0,1,[1,1000]));
u = abs(fftn(fftshift(F_11.*nn)));

Finally, just to check that u does actually reproduce a spectrum as F_11, I try going backwards as follows

ps =  abs(ifftn(ifftshift(u)));

But, when plotting ps, it does not exactly match F_11

enter image description here

In the high frequency area, ps drifts upwards, which is quite weird.

Would you mind to sketch the flaw in my procedure?


Your u variable is just the magnitude of the FFT, not the actual complex numbers that represent the FFT. Try removing the abs() from u and then doing the IFFT.

  • $\begingroup$ Do you mean calling u = (fftn(fftshift(F_11.*nn))); and ps = abs(ifftn(ifftshift(u)));? $\endgroup$ – fpe Jan 24 '13 at 17:19
  • $\begingroup$ Yes. You can keep u in its complex number form and then call abs() or angle() on it before plotting depending on if you want to see the magnitude or the phase of the FFT. $\endgroup$ – user1860611 Jan 24 '13 at 17:51
  • $\begingroup$ But I wanna recover the power spectrum. I have no interest in evaluating amplitudes and phase. Perhaps the issue comes from using fft instead of 1D fft $\endgroup$ – fpe Jan 24 '13 at 18:07
  • $\begingroup$ The power spectrum is the magnitude squared of the FFT. Normally I would take a time signal x and have X=fft(x), then ps=abs(X).^2=X*X', but to get back to x I would do x=ifft(X) not x=ifft(ps) I don't think your u is a time series. $\endgroup$ – user1860611 Jan 24 '13 at 18:35

Can you first generate white noise and then filter it with the power spectrum that you desire? You can generate white Gaussian noise using wgn1.


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.