%fminsearchBugTest1

% We will minimize the function f(x)=2+(x-2.0)^2+(y-3.0)^2
% but we will pass the 2.0 and 3.0 through an additional
% parameter called dataStructure.

%fminsearch goes fine, and in fact comes to the end of the
% search, but then it fails on the last call. I think
% this is where it is_absolute_filename
% calculating the average value of the vertices to
% report the final central values. On that final call
% to the function (perhaps several calls-- one for each
% vertex) it reports that dataStructure is undefined.

dataStructure{1}=2.0;
dataStructure{2}=3.0;

beta0=[1.5 2.8];

[beta,fval] = fminsearch('fminsearchBugTestFunction',beta0, ...
   optimset('TolX',1e-6,'TolFun',1e-6,'Display','iter','MaxIter',20000,'MaxFunEvals',40000),dataStructure);
