I'm trying to generate a time-history from a synthetic PSD.
My idea (happy to accept other solutions) was to turn the PSD into an FFT and then use ifft to turn it into a time-history. Note: I know that in the PSD the phase information is missing. In my case, however, a randomly generated phase could do the trick.
I'm having however some difficuties in the normalization of the amplitude in the PSD->FFT passage.
At the moment my code looks like this:
[S, f] = pwelch(x,,,,fsamp);
mag = sqrt(S);
fft_mag = abs(fft(x))/length(x);
However, if I compare these two, I see that they are still off by roughtly a factor of 10.
Where is the error? Is there a better way to generate a time-history from an arbitrary PSD?