Home > wafo > spec > freqtype.m

freqtype

PURPOSE

returns the frequency type of a Spectral density struct.

SYNOPSIS

ftype=freqtype(S)

DESCRIPTION

```  FREQTYPE returns the frequency type of a Spectral density struct.

CALL: ftype = freqtype(S)

ftype = 'f' if frequency is given in Hz
'w' if frequency is given in rad/s
'k' if a wave number spectrum is given
S = spectral density struct

CROSS-REFERENCE INFORMATION

This function calls:
 fieldnames Get structure field names. lower Convert string to lowercase. strcmp Compare strings. warning Display warning message; disable or enable warning messages.
This function is called by:
 scalespec Scale spectral density so that the moments equals m0,m2. spec2cov Computes covariance function and its derivatives spec2cov2 Computes covariance function and its derivatives, alternative version spec2dt Computes sampling interval from Nyquist frequency in spectrum spec2linspec Separates the linear component of the Spectrum spec2mmtpdf Calculates joint density of Maximum, minimum and period. spec2nlsdat Simulates a Randomized 2nd order non-linear wave X(t) spec2sdat Simulates a Gaussian process and its derivative from spectrum specinterp Interpolation and zero-padding of spectrum wspecplot Plot a spectral density

SOURCE CODE

```01 function ftype=freqtype(S)
02 % FREQTYPE returns the frequency type of a Spectral density struct.
03 %
04 % CALL: ftype = freqtype(S)
05 %
06 %  ftype = 'f' if frequency is given in Hz
07 %          'w' if frequency is given in rad/s
08 %          'k' if a wave number spectrum is given
09 %      S = spectral density struct
10 %
12
13 % History:
14 %  revised pab 17.02.2000
16 % revised pab 24.01.2000
17 %  - added check if field exist
18 % by pab
19
20 names=fieldnames(S);
21 ind=find(strcmp(names,'f')+strcmp(names,'w')+strcmp(names,'k')); %options are 'f' and 'w' and 'k'
22 if isempty(ind)
23   warning('This is not a spectral density structure')
24   ftype=[];
25 else
26   ftype=lower(names{ind});
27 end```

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