lsqcurvefit error when using example
Show older comments
When I copy/paste
myfun = @(x,xdata) x(1)*exp(x(2)*xdata);
% Assume you determined xdata and ydata experimentally
xdata = [0.9 1.5 13.8 19.8 24.1 28.2 35.2 60.3 74.6 81.3];
ydata = [455.2 428.6 124.1 67.3 43.2 28.1 13.1 -0.4 -1.3 -1.5];
x0 = [100; -1];
[x] = lsqcurvefit(myfun,x0,xdata,ydata);
into the command window I get the following error.
??? Attempt to reference field of non-structure array.
Error in ==> optimget>optimgetfast at 95
value = defaultopt.(name);
Error in ==> optimget at 25
o = optimgetfast(options,name,default);
Error in ==> lsqncommon at 24
switch optimget(options,'Display',defaultopt,'fast')
Error in ==> lsqcurvefit at 182
[x,Resnorm,FVAL,EXITFLAG,OUTPUT,LAMBDA,JACOB] = ...
Accepted Answer
More Answers (0)
Categories
Find more on Nonlinear Optimization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!