How to generate a time signal from spectrum
16 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
I'm working on spectrum comes from sea wave data. I have a JONSWAP spectrum and I need to generate a signal in time domain to fed my numerical model of a floating body, can anybody suggest me how do it.
1 commentaire
Mirlan Karimov
le 5 Fév 2018
If you could get any result please share it with me via mirlankarimov@hotmail.com I am working on the same problem
Réponses (2)
Isaac
le 9 Août 2024
If you have a power spectral density function (PSD), and not a fourier series of the Jonswap then you can't just take an ifft of the spectrum because it is a measure of energy of a frequency band (m^2/Hz), and it no longer has any phase information.
This function will generate a timeseries from a PSD based on equations 8 and 9 in Tabeshpour, 2023. It uses the rand() function to add back in phase, so it will generate a different result each time it is run. If you require preserveing a time series, you can save the rand seed in MATLAB by using rng() (see https://www.mathworks.com/help/matlab/ref/rng.html?searchHighlight=rng&s_tid=srchtitle_support_results_1_rng)
function [t,wave] = PSD_Time(df,Sj)
% Method derived from:
% Tabeshpour, M. R., & Belvasi, N. (2023). Ocean waves
% time-series generation: minimum required artificial wave time-series
% for wave energy converter analysis. Journal of Marine Engineering &
% Technology, 22(6), 273–283. https://doi.org/10.1080/20464177.2023.2197280
l=length(Sj);
t=linspace(0,df^-1,l);%generate output time vector
di=rand(1,l)*2*pi;%random phase angle generation
wi=[df:df:df*l]*2*pi;%Angular frequency
ai=sqrt(2*Sj*df);%Cos wave amplitudes
ni=ai.*cos(wi.*t'+di);%Matrix of all Cos waves
wave=sum(ni,2)';%Add Cos waves together
end
0 commentaires
Voir également
Catégories
En savoir plus sur Spectral Measurements dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!