SPEC2DT Computes sampling interval from Nyquist frequency in spectrum CALL : dT = spec2dt(S) dT = sampling interval, unit: [m] if wave number spectrum, [s] else S = spectrum struct Let wm be maximum frequency/wave number in spectrum, then dT=pi/wm if angular frequency, dT=1/(2*wm) if natural frequency (Hz)
returns the frequency type of a Spectral density struct. | |
Get structure field contents. | |
Compare strings. |
% CHAPTER2 Modelling random loads and stochastic waves |
01 function dT = spec2dt(S); 02 % SPEC2DT Computes sampling interval from Nyquist frequency in spectrum 03 % 04 % CALL : dT = spec2dt(S) 05 % 06 % dT = sampling interval, unit: [m] if wave number spectrum, [s] else 07 % S = spectrum struct 08 % 09 % Let wm be maximum frequency/wave number in spectrum, 10 % then dT=pi/wm if angular frequency, dT=1/(2*wm) if natural frequency (Hz) 11 12 % Tested on Matlab 5.3 13 % Revised by es 25.05.00: help text + call to freqtype 14 15 ftype=freqtype(S); 16 17 n=length(getfield(S,ftype)); 18 19 if strcmp(ftype,'w') 20 dT=pi/(S.w(n)); 21 elseif strcmp(ftype,'f') 22 dT=1/(2*S.f(n)); % sampling interval=1/Fs 23 else 24 dT=pi/(S.k(n)); 25 end 26 27
Comments or corrections to the WAFO group