Re: fitgammademo - error "constr" function not found ...

>Hi Denis,
>
>I am trying to run "fitgammademo" in PsychToolbox 2.52
>and I am getting the error copied below.
>
>Does this assume the presence of an additional MATLAB Toolbox?
>
>Is there an alternative curve-fitting/minimization function I could
>call instead?
>
>thanks,
> David Jones
>
>
>»fitgammademo
>Fitting with simple power function
>??? Undefined function or variable 'constr'.
>
>Error in ==> Cytochrome:Applications:Lab:MATLAB
>5.2.1:Toolbox:Psychtoolbox 2.52:PsychGamma:FitGammaPow.m
>On line 14 ==> x =
>constr('FitGammaPowFun',x0,options,[],[],[],values_in,measurements);
>
>Error in ==> Cytochrome:Applications:Lab:MATLAB
>5.2.1:Toolbox:Psychtoolbox 2.52:PsychGamma:FitGamma.m
>On line 66 ==> [fit_out1(:,i),x1(:,i),error(1,i)] = ...
>
>Error in ==> Cytochrome:Applications:Lab:MATLAB
>5.2.1:Toolbox:Psychtoolbox 2.52:PsychDemos:FitGammaDemo.m
>On line 40 ==> [simpleFit,simpleX] =
>FitGamma(typicalGammaInput,typicalGammaData,output,1);
>
>
>- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>Prof. David Jones, Dept of Electrical and Computer Engineering
>McMaster University, 1280 Main Street West, Hamilton, Ontario, CANADA
>email: djones@... phone: (905) 525-9140 ext.24689
>web: www.ece.mcmaster.ca/~djones fax: (905) 521-2922


dear david

i don't know much about the gamma stuff. however, FitGammaDemo runs
fine on my computer, and I note that "which constr" shows that
"constr" is part of the Optimization Toolbox.

I'm adding a note, now, to the help for FitGammaDemo to indicate that
it requires the Optimization Toolbox. I'm sorry, but I don't have any
suggestions for a work around.

best

denis

p.s. here's the help text for CONSTR:

CONSTR Finds the constrained minimum of a function of several variables.

X=CONSTR('FUN',X0) starts at X0 and finds a constrained minimum to
the function which is described in FUN (usually an M-file: FUN.M).
The function 'FUN' should return two arguments: a scalar value of the
function to be minimized, F, and a matrix of constraints, G:
[F,G]=FUN(X). F is minimized such that G <= zeros(size(G)).

X=CONSTR('FUN',X,OPTIONS) allows a vector of optional parameters to
be defined. For more information type HELP FOPTIONS.

X=CONSTR('FUN',X,OPTIONS,VLB,VUB) defines a set of lower and upper
bounds on the design variables, X, so that the solution is always in
the range VLB <= X <= VUB.

X=CONSTR('FUN',X,OPTIONS,VLB,VUB,'GRADFUN') allows a function
'GRADFUN' to be entered which returns the partial derivatives of the
function and the constraints at X: [gf,GC] = GRADFUN(X).
Use OPTIONS(9)=1 to check analytic gradients in GRADFUN against
numeric gradients during the first iteration.

X=CONSTR('FUN',X,OPTIONS,VLB,VUB,'GRADFUN',P1,P2,...) passes the
problem-dependent parameters P1,P2,... directly to the functions FUN
and GRADFUN: FUN(X,P1,P2,...) and GRADFUN(X,P1,P2,...). Pass
empty matrices for OPTIONS, VLB, VUB, and 'GRADFUN' to use the
default values.

[X,OPTIONS]=CONSTR('FUN',X0,...) returns the parameters used in the
optimization method. For example, OPTIONS(10) contains the number
of function evaluations used.

[X,OPTIONS,LAMBDA]=CONSTR('FUN',X0,...) returns the Lagrange multipliers
at the solution X in the vector LAMBDA.

[X,OPTIONS,LAMBDA,HESS]=CONSTR('FUN',X0,...) returns the quasi-Newton
approximation to the Hessian matrix at the solution X.

Copyright (c) 1990-98 by The MathWorks, Inc.
$Revision: 1.43 $ $Date: 1997/11/29 01:23:00 $