Thank you for your sharing code. I wonder that if you use FFT to transform frequency matrix to time series correlty. The code you written is as follows:
for ii = 1:N
tmp_u = (fft((H_u(ii,:)))); % FFT
tmp_v = (fft((H_v(ii,:))));
tmp_w = (fft((H_w(ii,:))));
% Up to this point only the one-sided spectrum has been considered to
% lighten the computational effort, since the double-sided spectrum is
% an even function about the frequency axis.
% Therefore, we can now merge real and imaginary part of the fft to get
% the ultimate time series.
U(ii,:) = [real(tmp_u) imag(tmp_u)];
V(ii,:) = [real(tmp_v) imag(tmp_v)];
W(ii,:) = [real(tmp_w) imag(tmp_w)];
I think ifft should be used here.
Thank you for this script.
I think there is a mistake in the IEC 61400-1 implementation, the power spectrum for Kaimal should be with a 5/3 power and not a 5/6:
PSD(i,IVec)=SigmaLU(IVec)/(1.0 + LU(IVec)*Freq(i))^Exp3
Moreover the calculated time series is artifically scaled to the desired mean & standard deviation, but the calculation output seems to be very far from the desired value. I therefore suspect an error in the code.
A lot of lines could be vectorized.
Thank you for your sharing work.
I met the following problem. It seems that function lapack can't be found.
Is this subroutine needs additional toolbox?
Undefined function 'lapack' for input arguments of type 'char'.
Error in Sandia_3D_method (line 287)
U = lapack('SPPTRF','L',Ntot,H,0);