Home > wafo > spec > spec2dt.m

spec2dt

PURPOSE ^

Computes sampling interval from Nyquist frequency in spectrum

SYNOPSIS ^

dT = spec2dt(S);

DESCRIPTION ^

  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)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

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

Mathematical Statistics
Centre for Mathematical Sciences
Lund University with Lund Institute of Technology

Comments or corrections to the WAFO group


Generated on Thu 06-Oct-2005 02:21:16 for WAFO by m2html © 2003