Home > wafo > spec > lagtype.m

# lagtype

## PURPOSE

Returns the lag type of a Covariance struct.

## SYNOPSIS

ltype = lagtype(R)

## DESCRIPTION

``` LAGTYPE Returns the lag type of a Covariance struct.

CALL:  ltype = lagtype(R)

ltype = Character vector containing:
'x' if lag of first space dimension is given.
'y' if lag of second space dimension is given.
't' if time lag is given
R = Covariance function structure

Example:
R = spec2cov(jonswap);
lagtype(R)

## CROSS-REFERENCE INFORMATION

This function calls:
 char Create character array (string). fieldnames Get structure field names. strcmp Compare strings. warning Display warning message; disable or enable warning messages.
This function is called by:
 cov2sdat Simulates a Gaussian process and its derivative spec2sdat Simulates a Gaussian process and its derivative from spectrum

## SOURCE CODE

```01 function ltype = lagtype(R)
02 %LAGTYPE Returns the lag type of a Covariance struct.
03 %
04 % CALL:  ltype = lagtype(R)
05 %
06 %  ltype = Character vector containing:
07 %          'x' if lag of first space dimension is given.
08 %          'y' if lag of second space dimension is given.
09 %          't' if time lag is given
10 %      R = Covariance function structure
11 %
12 % Example:
13 %  R = spec2cov(jonswap);
14 %  lagtype(R)
15 %
17
18 % Tested on: matlab 5.2
19 % History:
20 % by pab 11.10.2001
21
22 names=fieldnames(R);
23 ind=find(strcmp(names,'x')+strcmp(names,'y')+strcmp(names,'t')); %options are 'x' and 'y' and 't'
24 if isempty(ind)
25   warning('This is not a Covariance structure')
26   ltype=[];
27 else
28   ltype=char(names(ind)).';
29 end
30```

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