# check power spectrum

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 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 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.
• Do you mean calling u = (fftn(fftshift(F_11.*nn))); and ps = abs(ifftn(ifftshift(u)));?
• 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. Jan 24 '13 at 17:51
• 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. 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.