Exiting: Maximum number of function evaluations has been exceeded

33 Ansichten (letzte 30 Tage)
Hi,
I used ezyfit for gaussian functions. I got such errors.
Exiting: Maximum number of function evaluations has been exceeded
- increase MaxFunEvals option.
Current function value: 142.981920
Exiting: Maximum number of function evaluations has been exceeded
- increase MaxFunEvals option.
Current function value: 721.060509
I added "options = optimset('MaxFunEvals',1000);" but the error still exists.
Please suggest. thanks a lot!
load ('orientcurve.mat');
OSI=zeros(size(orientcurve,1),1);
tunewidth=zeros(size(orientcurve,1),1);
tunepref=NaN(size(orientcurve,1),1);
prefdF=zeros(size(orientcurve,1),1);
options = optimset('MaxFunEvals',1000);
for i=1:size(orientcurve,1)
orient=[-90 -45 0 45 90];
[~,I]=max(orientcurve(i,:));
calc_pref_or=I;
prefdF(i,3)=orientcurve(i,I);
if I==4
I=1;
else
I=I+1;
end
prefdF(i,4)=orientcurve(i,I);
if I==4
I=1;
else
I=I+1;
end
prefdF(i,5)=orientcurve(i,I);
prefdF(i,1)=orientcurve(i,I);
if I==4
I=1;
else
I=I+1;
end
prefdF(i,2)=orientcurve(i,I);
fit=ezfit(orient,prefdF(i,:),'y(x) = a*exp(-((x-x_0)^2)/(2*sigma^2)); x_0=0');
sigma=fit.m(2);
if abs(sigma)<15
fit=ezfit(orient,prefdF(i,:),'y(x) = a*exp(-((x-x_0)^2)/(2*sigma^2)); sigma=15; x_0=0');
sigma=fit.m(2);
end
end
  3 Kommentare
Walter Roberson
Walter Roberson am 10 Sep. 2022
The third party ezyfit toolbox http://www.fast.u-psud.fr/ezyfit/html/ezfit.html is specifically documented as using fminsearch() internally.
However, it is not documented as accepting any fminsearch() options -- not unless its fitparam function http://www.fast.u-psud.fr/ezyfit/html/fitparam.html allows that.
John D'Errico
John D'Errico am 10 Sep. 2022
I'd looked at it, and saw no capability to pass in any parameters, so an edit would be needed, and an edit done to someone else's code is just dangerous.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 10 Sep. 2022
Bearbeitet: Walter Roberson am 10 Sep. 2022
https://www.mathworks.com/matlabcentral/fileexchange/10176-ezyfit-2-44 is not documented as accepting options. The function would have to be edited to permit options.
  17 Kommentare
Walter Roberson
Walter Roberson am 15 Dez. 2023
Yes, those are my changes, and No, I did not contact Frederic Moisy
Sim
Sim am 15 Dez. 2023
Thanks for the information :-)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Linear and Nonlinear Regression finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by