diff m-toolbox/classes/@pest/setChi2.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/classes/@pest/setChi2.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,103 @@
+% SETCHI2 Set the property 'chi2'
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% DESCRIPTION: SETCHI2 Set the property 'chi2'
+%
+% CALL:        obj = obj.setChi2(37);
+%              obj = obj.setChi2(plist('Chi2', 37));
+%              obj.setChi2(37);
+%
+% INPUTS:      obj - can be a vector, matrix, list, or a mix of them.
+%              pl  - to set the 'chi2' with a plist specify only one plist with
+%                    only one key-word 'chi2'.
+%
+% <a href="matlab:utils.helper.displayMethodInfo('pest', 'setChi2')">Parameters Description</a>
+%
+% VERSION:     $Id: setChi2.m,v 1.7 2011/04/08 08:56:25 hewitson Exp $
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+function varargout = setChi2(varargin)
+
+  %%% Check if this is a call for parameters
+  if utils.helper.isinfocall(varargin{:})
+    varargout{1} = getInfo(varargin{3});
+    return
+  end
+  
+  prop = 'chi2';
+
+  % Collect input variable names
+  in_names = cell(size(varargin));
+  for ii = 1:nargin,in_names{ii} = inputname(ii);end
+  
+  import utils.const.*
+  utils.helper.msg(msg.PROC3, 'running %s/%s', mfilename('class'), mfilename);
+  
+  % Check if this is a call from a class method
+  callerIsMethod = utils.helper.callerIsMethod;
+  
+  if nargout >= 1
+    out = genericSet(varargin{:}, prop, in_names, callerIsMethod);
+  else
+    genericSet(varargin{:}, prop, in_names, callerIsMethod);
+    out = varargin{1};
+  end
+  
+  % Set output
+  if nargout == numel(out)
+    % List of outputs
+    for ii = 1:numel(out)
+      varargout{ii} = out(ii);
+    end
+  else
+    % Single output
+    varargout{1} = out;
+  end
+
+end
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%                               Local Functions                               %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% FUNCTION:    getInfo
+%
+% DESCRIPTION: Get Info Object
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+function ii = getInfo(varargin)
+  if nargin == 1 && strcmpi(varargin{1}, 'None')
+    sets = {};
+    pl   = [];
+  else
+    sets = {'Default'};
+    pl   = getDefaultPlist;
+  end
+  % Build info object
+  ii = minfo(mfilename, 'pest', 'ltpda', utils.const.categories.helper, '$Id: setChi2.m,v 1.7 2011/04/08 08:56:25 hewitson Exp $', sets, pl);
+end
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% FUNCTION:    getDefaultPlist
+%
+% DESCRIPTION: Get Default Plist
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+function plout = getDefaultPlist()
+  persistent pl;  
+  if exist('pl', 'var')==0 || isempty(pl)
+    pl = buildplist();
+  end
+  plout = pl;  
+end
+
+function plo = buildplist()
+  plo = plist({'chi2', 'Reduced chi^2 of the final fit for the parameter estimate (pest) object.'}, []);
+end
+