Home > wafo > multidim > specoptset.m

specoptset

PURPOSE ^

Create or alter SPECTRUM OPTIONS structure.

SYNOPSIS ^

options = specoptset(varargin)

DESCRIPTION ^

 SPECOPTSET Create or alter SPECTRUM OPTIONS structure. 
  
   CALL:  options = specoptset(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 'dat2dspec', 'dat2spec'. 
    opts1, 
    opts2..    = options structures 
    par1,par2..= strings identifying the parameter to alter 
    val1,val2..= corresponding values the parameters are altered to. 
     
    SPECOPTSET 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. 
     
    SPECOPTSET with no input arguments and no output arguments displays all  
    parameter names and their possible values. 
  
    SPECOPTSET with no input arguments creates an options structure 
    OPTIONS where all the fields are set to []. 
  
     
  SPECOPTSET PARAMETERS 
      nharm     = number of harmonics in Fourier coefficients (Fcof)     (default 2) 
    gravity     = acceleration of gravity                                (default see gravity) 
   wdensity     = water density,                                         (default see wdensity) 
       bet      = 1, theta given as directions toward which waves travel (default) 
                 -1, theta given as directions from which waves come  
       igam     = 1, if z is measured + upward from mean water level     (default) 
                  2, if z is measured + downward from mean water level 
                  3, if z is measured + upward from sea floor 
  x-axisdir     = angle clockwise from true north to + x-axis in degrees (default 90) 
  y-axisdir     = angle clockwise from true north to + y-axis in degrees (default 0) 
   plotflag     = 0 no plotting (default) 
                  1 plots the spectrum, S,      
                  2 plot  plots spectral density and the directional spreading 
   dflag        = specifies a detrending performed on the signal before estimation. 
                  'mean','linear' or 'ma' (= moving average)             (default 'mean')    
   ftype        = frequency type, 'w' or 'f'  (default 'w') 
  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'. 
  message       = Level of screeen display. 
  maxIter       = maximum number of iterations used in estimate. various 
                  effects for differnt methods 
  maxCoef       = maximum spectral coefficient 
  coefAbsTol    = acceptance tolerance for spectral coefficents. 
  errorTol      = acceptance tolerance for the directional spreading. 
  minModelOrder = Minimum model order (BDM, EMEM) 
  maxModelOrder = Maximum model order (BDM, EMEM) 
  relax         = start relaxation parameter 
  
  Examples: 
   specoptset('dat2dspec') 
   specoptset('dat2dspec','ftype','f','thtype','degrees') 
  
  See also  dat2spec, dat2dspec

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

001 function options = specoptset(varargin) 
002 %SPECOPTSET Create or alter SPECTRUM OPTIONS structure. 
003 % 
004 %  CALL:  options = specoptset(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 'dat2dspec', 'dat2spec'. 
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 %   SPECOPTSET 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 %   SPECOPTSET with no input arguments and no output arguments displays all  
033 %   parameter names and their possible values. 
034 % 
035 %   SPECOPTSET with no input arguments creates an options structure 
036 %   OPTIONS where all the fields are set to []. 
037 % 
038 %    
039 % SPECOPTSET PARAMETERS 
040 %     nharm     = number of harmonics in Fourier coefficients (Fcof)     (default 2) 
041 %   gravity     = acceleration of gravity                                (default see gravity) 
042 %  wdensity     = water density,                                         (default see wdensity) 
043 %      bet      = 1, theta given as directions toward which waves travel (default) 
044 %                -1, theta given as directions from which waves come  
045 %      igam     = 1, if z is measured + upward from mean water level     (default) 
046 %                 2, if z is measured + downward from mean water level 
047 %                 3, if z is measured + upward from sea floor 
048 % x-axisdir     = angle clockwise from true north to + x-axis in degrees (default 90) 
049 % y-axisdir     = angle clockwise from true north to + y-axis in degrees (default 0) 
050 %  plotflag     = 0 no plotting (default) 
051 %                 1 plots the spectrum, S,      
052 %                 2 plot  plots spectral density and the directional spreading 
053 %  dflag        = specifies a detrending performed on the signal before estimation. 
054 %                 'mean','linear' or 'ma' (= moving average)             (default 'mean')    
055 %  ftype        = frequency type, 'w' or 'f'  (default 'w') 
056 % Plotflag      = 'off'   or 0: No plotting (Default) 
057 %                 'final' or 1: Plot final result 
058 %                 'iter'  or 2: Monitor the development. 
059 % Delay         = Delay time for each plot when PLOTFLAG=='iter'. 
060 % message       = Level of screeen display. 
061 % maxIter       = maximum number of iterations used in estimate. various 
062 %                 effects for differnt methods 
063 % maxCoef       = maximum spectral coefficient 
064 % coefAbsTol    = acceptance tolerance for spectral coefficents. 
065 % errorTol      = acceptance tolerance for the directional spreading. 
066 % minModelOrder = Minimum model order (BDM, EMEM) 
067 % maxModelOrder = Maximum model order (BDM, EMEM) 
068 % relax         = start relaxation parameter 
069 % 
070 % Examples: 
071 %  specoptset('dat2dspec') 
072 %  specoptset('dat2dspec','ftype','f','thtype','degrees') 
073 % 
074 % See also  dat2spec, dat2dspec 
075  
076 % History 
077 % revised pab, Dec 2003 
078 %  replaced code with call to parseoptions   
079 % by pab 22.10.2002 
080 % based on MATLAB's optimset 
081  
082  
083 % Print out possible values of properties. 
084 if (nargin == 0) & (nargout == 0) 
085 %  disp('          method: [ {''cov''} | ''psd'' | ''psdo'' | ''pmem'' | ''pburg'' ] (dat2spec)') 
086 %  disp('          method: [ {''mlm''} | ''imlm'' | ''mem'' | ''emem'' | ''fem'' ] (dat2dspec)') 
087   disp('           dflag: [ {''mean''} | ''linear'' | ''ma'' (= moving average)') 
088   disp('           ftype: [ {''w''} | ''f'' ]') 
089   disp('          thtype: [ {''radians''} | ''degrees'' ]')  
090 %  disp('            nfft: [ {128} ]') 
091   disp('        noverlap: [ {0} ]') 
092   disp('          window: [ vector {hanning(nfft)}]') 
093   disp('         gravity: [ positive scalar or vector {gravity}]') 
094   disp('        wdensity: [ positive integer {wdensity}]') 
095   disp('             bet: [ {1} | 1 ]' ) 
096   disp('            igam: [ {1} | 2 |3 ]') 
097   disp('       x_axisdir: [ {90} ]') 
098   disp('       y_axisdir: [ {0} ]') 
099   disp('         message: [ positive integer {2000}]') 
100   disp('        Plotflag: [ off | {final} | iter ]') 
101   disp('           Delay: [ positive scalar {0} ]') 
102   disp('         maxIter: [ {30} ]') 
103   disp('      coefAbsTol: [ {0.01} ]') 
104   disp('         maxcoef: [ [] ]') 
105   disp('        errorTol: [ {0.01} ]') 
106   disp('   minModelOrder: [ {1} ]') 
107   disp('   maxModelOrder: [ {[]} ]') 
108   disp('           relax: [ {1} ]') 
109    
110   return; 
111 end 
112  
113 % Initialization 
114 % Legal functions names 
115 fnames = strvcat('dat2spec','dat2dspec');  
116 % Legal parameter names 
117 names  = lower({'dflag','ftype','thtype','noverlap','window',... 
118         'message','plotflag','delay', ... 
119         'nharm','gravity','wdensity',... 
120         'bet', 'igam','x_axisdir','y_axisdir',... 
121         'maxIter','coefAbsTol','errorTol',... 
122         'minModelOrder','maxModelOrder','relax','maxCoef'});      
123  
124 %default values 
125 defaultVals = {'mean','w','radians',0,[],.... 
126            2000,'final',0,... 
127            2,gravity,wdensity,... 
128            1,1,90, 0,... 
129            30, 0.01,0.01,... 
130            1 , [], 1, []}; 
131  
132 options = cell2struct(defaultVals,names,2); 
133 options = parseoptions(fnames,options,varargin{:}); 
134 return

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