Time series from Power Spectral Density (PSD)

87 次查看(过去 30 天)
Hi, I would like to compute different time series (time realizations) of a given PSD. I've read there are several methods using random phase and amplitude or going through an IFFT. Is there any method already built in Matlab or how should this be done? I paste here below an example of a PSD. Thanks!
f = [6.5e-4 5.8e-2 5];
PSD = [1e2 1e-2 1e-6];
coef = polyfit(log10(f),log10(PSD),1);
f2 = linspace(0.8*1e-4,20,1000);
PSD2 = 10.^(polyval(coef,log10(f2)));
loglog(f2,PSD2);grid on;
xlabel('Hz');ylabel('m^2/Hz')

采纳的回答

William Rose
William Rose 2023-6-3
@Albert Zurita, you wrote:
I would like to compute different time series (time realizations) of a given PSD. I've read there are several methods using random phase and amplitude or going through an IFFT.
You are partly correct. If you know the PSD you can compute the amplitude spectrum. You can use phases that are all zero, or that are random, or whatever you choose. Then you can compute th inverse FFT.
I assume the time sequence is to be a real sequence, not complex. If so, then the phase angle ust be zero or pi/2 at the Nyquist frequency (fNyq) (assuming an even number of samples; if the number is odd, then the Nyquist frequency will not be sampled...), and all complex components of hte spectrum above fNyq must be the complex conjugates of their "mirror images" below fNyq.
If you follow these guidelines then the ifft of the complex spectrum will yield a real sequence, as you probably desire.
  14 个评论
William Rose
William Rose 2023-6-6
You get NaNs from interp1() because the "interpolation" is really extrapolation: you request values out to 20 Hz, but the input pairs only go as high as 6 Hz. The use of logs is not the issue. Consider the following example, in which the input frequencies range from 0 to 6, and the requested frequencies go from 0 to 20:
f=[0 6]; PSD=[10 1]; f2=linspace(0,20,6)
f2 = 1×6
0 4 8 12 16 20
PSD2=interp1(f,PSD,f2)
PSD2 = 1×6
10.0000 2.8000 NaN NaN NaN NaN
To eliminate the NaNs in PSD2, reduce the top frequency in f2 to 6 Hz, or increase the highest frequency in f to 20 Hz (and add a corresponding value to PSD).
Albert Zurita
Albert Zurita 2023-6-6
However, the use of logs does a non-uniform interpolation, I should dig more on ways to interpolate straight lines in log scale...anyway thanks for the well explained answer.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Parametric Spectral Estimation 的更多信息

产品


版本

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by