RINDOPTSET Create or alter RIND OPTIONS structure. CALL: options = rindoptset(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 'rind', 'spec2mmtpdf', 'spec2thpdf'. opts1, opts2.. = options structures par1,par2..= strings identifying the parameter to alter val1,val2..= corresponding values the parameters are altered to. RINDOPTSET 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. RINDOPTSET with no input arguments and no output arguments displays all parameter names and their possible values. RINDOPTSET with no input arguments creates an options structure OPTIONS where all the fields are set to their default values. RINDOPTSET PARAMETERS METHOD = INTEGER defining the integration method 0 Integrate by Gauss-Legendre quadrature (Podgorski et al. 1999) 1 Integrate by SADAPT for Ndim<9 and by KRBVRC otherwise (default) 2 Integrate by SADAPT by Genz (1992) (Fast) 3 Integrate by KRBVRC by Genz (1993) (Fast) 4 Integrate by KROBOV by Genz (1992) (Fast) 5 Integrate by RCRUDE by Genz (1992) XCSCALE = REAL to scale the conditinal probability density, i.e., f_{Xc} = exp(-0.5*Xc*inv(Sxc)*Xc + XcScale) (default XcScale =0) ABSEPS = REAL absolute error tolerance. (default 0) RELEPS = REAL relative error tolerance. (default 1e-3) COVEPS = REAL error tolerance in Cholesky factorization (default 1e-13) MAXPTS = INTEGER, maximum number of function values allowed. This parameter can be used to limit the time. A sensible strategy is to start with MAXPTS = 1000*N, and then increase MAXPTS if ERROR is too large. (Only for METHOD~=0) (default 40000) MINPTS = INTEGER, minimum number of function values allowed. (Only for METHOD~=0) (default 0) SEED = INTEGER, seed to the random generator used in the integrations (Only for METHOD~=0)(default floor(rand*1e9)) NIT = INTEGER, maximum number of Xt variables to integrate This parameter can be used to limit the time. If NIT is less than the rank of the covariance matrix, the returned result is a upper bound for the true value of the integral. (default 1000) XCUTOFF = REAL cut off value where the marginal normal distribution is truncated. (Depends on requested accuracy. A value between 4 and 5 is reasonable.) XSPLIT = parameters controlling performance of quadrature integration: if Hup>=xCutOff AND Hlo<-XSPLIT OR Hup>=XSPLIT AND Hlo<=-xCutOff then do a different integration to increase speed in rind2 and rindnit. This give slightly different results if XSPILT>=xCutOff => do the same integration allways (Only for METHOD==0)(default XSPLIT = 1.5) QUADNO = Quadrature formulae number used in integration of Xd variables. This number implicitly determines number of nodes used. (Only for METHOD==0) SPEED = defines accuracy of calculations by choosing different parameters, possible values: 1,2...,9 (9 fastest, default []). If ~isempty(SPEED) the parameters, ABSEPS, RELEPS, COVEPS, XCUTOFF, MAXPTS and QUADNO will be set according to INITOPTIONS. Examples: rindoptset('rind') See also rind, initoptions
Initializes RIND options according to speed. | |
Create or alter a OPTIONS structure. | |
Create or alter RIND OPTIONS structure. | |
Convert cell array to structure array. | |
Display help text in Command Window. | |
Vertically concatenate strings. |
% CHAPTER3 Demonstrates distributions of wave characteristics | |
Initializes RIND options according to speed. | |
Computes multivariate normal expectations | |
Create or alter RIND OPTIONS structure. | |
Calculates joint density of Maximum, minimum and period. | |
Joint density of amplitude and period/wave-length characteristics | |
Evaluates densities for various wave periods or wave lengths | |
Intensity of trough-crest cycles computed from St | |
Probability density distributions (pdf) of wave period, Tt, | |
Joint distribution (pdf) of crest front velocity and wave height: | |
Joint distribution (pdf) of crest front period, Tcf, and crest amplitude, Ac | |
Joint distribution (pdf) of crest wavelength, Lc, and crest amplitude, Ac | |
Joint distribution (pdf) of crest wavelength, Lc, and crest amplitude, Ac for extremal waves | |
Intensity of rainflow cycles computed from St |
001 function options = rindoptsetrindoptset(varargin) 002 %RINDOPTSET Create or alter RIND OPTIONS structure. 003 % 004 % CALL: options = rindoptset(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 'rind', 'spec2mmtpdf', 'spec2thpdf'. 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 % RINDOPTSET 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 % RINDOPTSET with no input arguments and no output arguments displays all 033 % parameter names and their possible values. 034 % 035 % RINDOPTSET with no input arguments creates an options structure 036 % OPTIONS where all the fields are set to their default values. 037 % 038 % 039 % RINDOPTSET PARAMETERS 040 % METHOD = INTEGER defining the integration method 041 % 0 Integrate by Gauss-Legendre quadrature (Podgorski et al. 1999) 042 % 1 Integrate by SADAPT for Ndim<9 and by KRBVRC otherwise (default) 043 % 2 Integrate by SADAPT by Genz (1992) (Fast) 044 % 3 Integrate by KRBVRC by Genz (1993) (Fast) 045 % 4 Integrate by KROBOV by Genz (1992) (Fast) 046 % 5 Integrate by RCRUDE by Genz (1992) 047 % XCSCALE = REAL to scale the conditinal probability density, i.e., 048 % f_{Xc} = exp(-0.5*Xc*inv(Sxc)*Xc + XcScale) (default XcScale =0) 049 % ABSEPS = REAL absolute error tolerance. (default 0) 050 % RELEPS = REAL relative error tolerance. (default 1e-3) 051 % COVEPS = REAL error tolerance in Cholesky factorization (default 1e-13) 052 % MAXPTS = INTEGER, maximum number of function values allowed. This 053 % parameter can be used to limit the time. A sensible 054 % strategy is to start with MAXPTS = 1000*N, and then 055 % increase MAXPTS if ERROR is too large. 056 % (Only for METHOD~=0) (default 40000) 057 % MINPTS = INTEGER, minimum number of function values allowed. 058 % (Only for METHOD~=0) (default 0) 059 % SEED = INTEGER, seed to the random generator used in the integrations 060 % (Only for METHOD~=0)(default floor(rand*1e9)) 061 % NIT = INTEGER, maximum number of Xt variables to integrate 062 % This parameter can be used to limit the time. 063 % If NIT is less than the rank of the covariance matrix, 064 % the returned result is a upper bound for the true value 065 % of the integral. (default 1000) 066 % XCUTOFF = REAL cut off value where the marginal normal 067 % distribution is truncated. (Depends on requested 068 % accuracy. A value between 4 and 5 is reasonable.) 069 % XSPLIT = parameters controlling performance of quadrature 070 % integration: 071 % if Hup>=xCutOff AND Hlo<-XSPLIT OR 072 % Hup>=XSPLIT AND Hlo<=-xCutOff then 073 % do a different integration to increase speed 074 % in rind2 and rindnit. This give slightly different 075 % results 076 % if XSPILT>=xCutOff => do the same integration allways 077 % (Only for METHOD==0)(default XSPLIT = 1.5) 078 % QUADNO = Quadrature formulae number used in integration of Xd 079 % variables. This number implicitly determines number of nodes 080 % used. (Only for METHOD==0) 081 % SPEED = defines accuracy of calculations by choosing different 082 % parameters, possible values: 1,2...,9 (9 fastest, default []). 083 % If ~isempty(SPEED) the parameters, ABSEPS, RELEPS, COVEPS, 084 % XCUTOFF, MAXPTS and QUADNO will be set according to INITOPTIONS. 085 % 086 % Examples: 087 % rindoptset('rind') 088 % 089 % See also rind, initoptions 090 091 % History 092 % by pab 20.05.2003% NEW FUNCTIONS 093 % ~~~~~~~~~~~~~ 094 % based on MATLAB's optimset 095 096 097 % Print out possible values of properties. 098 if (nargin == 0) & (nargout == 0) 099 help rindoptset 100 return; 101 end 102 103 % Initialization 104 % Legal functions names 105 fnames = strvcat('rind','spec2mmtpdf','spec2thpdf','spec2tpdf2'); 106 % Legal parameter names 107 names = {'method','xcscale',... 108 'abseps','releps','coveps',... 109 'maxpts','minpts',... 110 'seed','nit','xcutoff',... 111 'xsplit','quadno', ... 112 'speed'}; 113 vals = {3,0,0,1e-3,1e-10,... 114 40000,... 115 0,... 116 floor(rand*1e9),... 117 1000,... 118 [],... 119 1.5,... 120 [] ,... 121 []}; 122 123 % Initialize options with default values 124 options = cell2struct(vals,names,2); 125 options = parseoptions(fnames,options,varargin{:}); 126 127 if ~isempty(options.speed) 128 options = initoptions(options.speed,options); 129 end 130 return 131
Comments or corrections to the WAFO group