How to generate a time signal from spectrum

21 次查看(过去 30 天)
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.

回答(2 个)

Abhishek Ballaney
编辑:Walter Roberson 2024-8-9,19:05

Isaac
Isaac 2024-8-9,18:15
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

类别

Help CenterFile Exchange 中查找有关 Oceanography and Hydrology 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by