Take the 2-minute tour ×
Signal Processing Stack Exchange is a question and answer site for practitioners of the art and science of signal, image and video processing. It's 100% free, no registration required.

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?

share|improve this question
add comment

migrated from stackoverflow.com Jan 24 '13 at 16:54

This question came from our site for professional and enthusiast programmers.

2 Answers

up vote 3 down vote accepted

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.

share|improve this answer
    
Do you mean calling u = (fftn(fftshift(F_11.*nn))); and ps = abs(ifftn(ifftshift(u)));? –  fpe Jan 24 '13 at 17:19
    
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. –  user1860611 Jan 24 '13 at 17:51
    
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 –  fpe Jan 24 '13 at 18:07
    
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. –  user1860611 Jan 24 '13 at 18:35
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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