1 ## Copyright (C) 2011 Olaf Till <olaf.till@uni-jena.de>
3 ## This program is free software; you can redistribute it and/or modify it under
4 ## the terms of the GNU General Public License as published by the Free Software
5 ## Foundation; either version 3 of the License, or (at your option) any later
8 ## This program is distributed in the hope that it will be useful, but WITHOUT
9 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 ## You should have received a copy of the GNU General Public License along with
14 ## this program; if not, see <http://www.gnu.org/licenses/>.
17 ## @deftypefn {Function File} {@var{info} =} residmin_stat (@var{f}, @var{p}, @var{x}, @var{y}, @var{settings})
19 ## Frontend for computation of statistics for fitting of values,
20 ## computed by a model function, to observed values.
22 ## Please refer to the description of @code{residmin_stat}. The only
23 ## differences to @code{residmin_stat} are the additional arguments
24 ## @var{x} (independent values) and @var{y} (observations), that the
25 ## model function @var{f}, if provided, has a second obligatory argument
26 ## which will be set to @var{x} and is supposed to return guesses for
27 ## the observations (with the same dimensions), and that the possibly
28 ## user-supplied function for the jacobian of the model function has
29 ## also a second obligatory argument which will be set to @var{x}.
31 ## @seealso {residmin_stat}
34 function ret = curvefit_stat (f, pfin, x, y, settings)
37 ret = __residmin_stat__ (f);
45 if (compare_versions (version (), "3.3.55", "<"))
46 ## optimset mechanism was fixed for option names with underscores
47 ## sometime in 3.3.54+, if I remember right
48 optimget = @ __optimget__;
50 if (! isempty (dfdp = optimget (settings, "dfdp")) && \
51 ! (ismatrix (dfdp) && ! ischar (dfdp)))
53 dfdp = str2func (dfdp);
55 settings.dfdp = @ (p, varargin) dfdp (p, x, varargin{:});
61 ret = __residmin_stat__ \
62 (f, pfin, settings, struct ("observations", y));
66 function ret = __optimget__ (s, name, default)
68 if (isfield (s, name))