Home > wafo > trgauss > troptset.m

troptset

PURPOSE ^

Create or alter TRANSFORM OPTIONS structure.

SYNOPSIS ^

options = troptset(varargin)

DESCRIPTION ^

 TROPTSET Create or alter TRANSFORM OPTIONS structure.
 
   CALL:  options = troptset(funcname,opts1,opts2,...,par1,val1,par2,val2,...);
 
    options    = transformation options structure in which the named 
                 parameters have the specified values.  
    funcname   = string giving the name of the function for which default
                 values for the options structure should be extracted.
                 Options are 'dat2tr', 'lc2tr', 'reconstruct'.
    opts1,
    opts2..    = options structures
    par1,par2..= strings identifying the parameter to alter
    val1,val2..= corresponding values the parameters are altered to.
    
    TROPTSET combines the default options for a function given by FUNCNAME
    with new options structures (OPTS1,OPTS2,...) and/or with the named
    parameters (PAR1,PAR2,...) with the corresponding values (VAL1, VAL2,...).
    The parameters are set in the same order as the input arguments.
    Any parameters with non-empty values of the options struct overwrite
    the corresponding old parameters. 
    The input arguments can be given in any order with one exception:
    PARx and VALx must be given in pairs in that order.
    Any unspecified parameters for PARx are set to []. 
    Parameters with value [] indicate to use the default value for that
    parameter when OPTIONS is passed to the function. It is sufficient to
    type only the 2 first characters to uniquely identify the parameter
    or function name.  Upper case letters for parameter names and values
    that are strings are ignored. If an invalid string is provided, the
    default is used.
    
    TROPTSET with no input arguments and no output arguments displays all 
    parameter names and their possible values.
 
    TROPTSET with no input arguments creates an options structure
    OPTIONS where all the fields are set to [].
 
    
  TROPTSET PARAMETERS
  ChkDer    - 'off' or 0: No check on the derivative of the transform.
              'on'  or 1: Check if transform have positive derivative 
  Csm, Gsm  - Defines the smoothing of the crossing intensity 
              and the transformation g, respectively. Valid values must 
              be 0<=Csm,Gsm<=1. (default Csm=0.9, Gsm=0.05)
              Smaller values gives smoother functions.
  Crossdef  - Crossing definition used in the crossing spectrum:
              'u'   or 1: only upcrossings
              'uM'  or 2: upcrossings and Maxima (default)
              'umM' or 3: upcrossings, minima, and Maxima.
              'um'  or 4: upcrossings and minima.
  Plotflag  - 'off'   or 0: No plotting (Default)
              'final' or 1: Plot final result
              'iter'  or 2: Monitor the development.
  Delay     - Delay time for each plot when PLOTFLAG=='iter'.
  Param     - Vector which defines the region of variation of the data x.
              (default [-5 5 501]). 
  LinExtrap - 'off' or 0: uses a regular smoothing spline. 
              'on'  or 1: use a smoothing spline with a constraint on the
                          ends to ensure linear extrapolation outside the
                          range of the data. (default)
  Cvar      - Variances for the the crossing intensity. (default  1) 
  Gvar      - Variances for the empirical transformation, g. (default  1) 
  Ne        - Number of extremes (maxima & minima) to remove from the
              estimation of the transformation. This makes the
              estimation more robust against outliers. (default 7)
  Ntr       - Maximum length of empirical crossing intensity or CDF.
              The empirical crossing intensity or CDF is interpolated
              linearly  before smoothing if their lengths exceeds Ntr.
              A reasonable NTR will significantly speed up the
              estimation for long time series without loosing any
              accuracy. NTR should be chosen greater than
              PARAM(3). (default 1000)
  multip    - 0 the data in columns belong to the same seastate (default).
              1 the data in columns are from separate seastates.
 
  Examples:
   troptset('lc2tr')
   troptset('lc2tr','csm',.99)
   troptset('csm',.99,'lc2tr')  % is the same as  troptset('lc2tr')
 
  See also  dat2tr, lc2tr, emptr, reconstruct

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

001 function options = troptset(varargin)
002 %TROPTSET Create or alter TRANSFORM OPTIONS structure.
003 %
004 %  CALL:  options = troptset(funcname,opts1,opts2,...,par1,val1,par2,val2,...);
005 %
006 %   options    = transformation options structure in which the named 
007 %                parameters have the specified values.  
008 %   funcname   = string giving the name of the function for which default
009 %                values for the options structure should be extracted.
010 %                Options are 'dat2tr', 'lc2tr', 'reconstruct'.
011 %   opts1,
012 %   opts2..    = options structures
013 %   par1,par2..= strings identifying the parameter to alter
014 %   val1,val2..= corresponding values the parameters are altered to.
015 %   
016 %   TROPTSET combines the default options for a function given by FUNCNAME
017 %   with new options structures (OPTS1,OPTS2,...) and/or with the named
018 %   parameters (PAR1,PAR2,...) with the corresponding values (VAL1, VAL2,...).
019 %   The parameters are set in the same order as the input arguments.
020 %   Any parameters with non-empty values of the options struct overwrite
021 %   the corresponding old parameters. 
022 %   The input arguments can be given in any order with one exception:
023 %   PARx and VALx must be given in pairs in that order.
024 %   Any unspecified parameters for PARx are set to []. 
025 %   Parameters with value [] indicate to use the default value for that
026 %   parameter when OPTIONS is passed to the function. It is sufficient to
027 %   type only the 2 first characters to uniquely identify the parameter
028 %   or function name.  Upper case letters for parameter names and values
029 %   that are strings are ignored. If an invalid string is provided, the
030 %   default is used.
031 %   
032 %   TROPTSET with no input arguments and no output arguments displays all 
033 %   parameter names and their possible values.
034 %
035 %   TROPTSET with no input arguments creates an options structure
036 %   OPTIONS where all the fields are set to [].
037 %
038 %   
039 % TROPTSET PARAMETERS
040 % ChkDer    - 'off' or 0: No check on the derivative of the transform.
041 %             'on'  or 1: Check if transform have positive derivative 
042 % Csm, Gsm  - Defines the smoothing of the crossing intensity 
043 %             and the transformation g, respectively. Valid values must 
044 %             be 0<=Csm,Gsm<=1. (default Csm=0.9, Gsm=0.05)
045 %             Smaller values gives smoother functions.
046 % Crossdef  - Crossing definition used in the crossing spectrum:
047 %             'u'   or 1: only upcrossings
048 %             'uM'  or 2: upcrossings and Maxima (default)
049 %             'umM' or 3: upcrossings, minima, and Maxima.
050 %             'um'  or 4: upcrossings and minima.
051 % Plotflag  - 'off'   or 0: No plotting (Default)
052 %             'final' or 1: Plot final result
053 %             'iter'  or 2: Monitor the development.
054 % Delay     - Delay time for each plot when PLOTFLAG=='iter'.
055 % Param     - Vector which defines the region of variation of the data x.
056 %             (default [-5 5 501]). 
057 % LinExtrap - 'off' or 0: uses a regular smoothing spline. 
058 %             'on'  or 1: use a smoothing spline with a constraint on the
059 %                         ends to ensure linear extrapolation outside the
060 %                         range of the data. (default)
061 % Cvar      - Variances for the the crossing intensity. (default  1) 
062 % Gvar      - Variances for the empirical transformation, g. (default  1) 
063 % Ne        - Number of extremes (maxima & minima) to remove from the
064 %             estimation of the transformation. This makes the
065 %             estimation more robust against outliers. (default 7)
066 % Ntr       - Maximum length of empirical crossing intensity or CDF.
067 %             The empirical crossing intensity or CDF is interpolated
068 %             linearly  before smoothing if their lengths exceeds Ntr.
069 %             A reasonable NTR will significantly speed up the
070 %             estimation for long time series without loosing any
071 %             accuracy. NTR should be chosen greater than
072 %             PARAM(3). (default 1000)
073 % multip    - 0 the data in columns belong to the same seastate (default).
074 %             1 the data in columns are from separate seastates.
075 %
076 % Examples:
077 %  troptset('lc2tr')
078 %  troptset('lc2tr','csm',.99)
079 %  troptset('csm',.99,'lc2tr')  % is the same as  troptset('lc2tr')
080 %
081 % See also  dat2tr, lc2tr, emptr, reconstruct
082 
083 % History
084 % revised pab 21Nov2003
085 %  -moved some code into parseoptions for easier maintainence    
086 % by pab 20.12.2000
087 % based on MATLAB's optimset
088 
089 
090 % Print out possible values of properties.
091 if (nargin == 0) & (nargout == 0)
092   disp('          ChkDer: [ off | {on} ]')
093   disp('             Csm: [ scalar between 0 and 1 {0.95} ]')
094   disp('             Gsm: [ scalar between 0 and 1 {0.05} ]')
095   disp('        Crossdef: [ u |{uM}| umM | um ]') 
096   disp('           Param: [ vector {-5 5 513} ]')
097   disp('       LinExtrap: [ off | {on} ]')
098   disp('            Cvar: [ positive scalar or vector {1}]')
099   disp('            Gvar: [ positive scalar or vector {1}]')
100   disp('              Ne: [ positive integer {7}]')
101   disp('             Ntr: [ positive integer {2000}]')
102   disp('        Plotflag: [ off | {final} | iter ]')
103   disp('           Delay: [ positive scalar {0} ]')
104   return;
105 end
106 
107 % Initialization
108 % Legal functions names
109 fnames = strvcat('dat2tr','lc2tr','cdf2tr','reconstruct'); 
110 
111 % Legal parameter names
112 names = {'chkder','csm','gsm','crossdef','param','linextrap','cvar', ...
113      'gvar','ne','ntr','plotflag','delay','multip'};
114 %default values
115 defaultVals = {'on',0.95,0.05,'uM',[-5 5 513],'on',1,1,7,2000,'final',0,0};
116 
117 options = cell2struct(defaultVals,names,2);
118 options = parseoptions(fnames,options,varargin{:});
119 
120 return
121 
122

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