Time series from Power Spectral Density (PSD)

166 vues (au cours des 30 derniers jours)
Albert Zurita
Albert Zurita le 2 Juin 2023
Commenté : Albert Zurita le 6 Juin 2023
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')

Réponse acceptée

William Rose
William Rose le 3 Juin 2023
@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 commentaires
William Rose
William Rose le 6 Juin 2023
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 le 6 Juin 2023
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.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Parametric Spectral Estimation dans Help Center et File Exchange

Produits


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by