Effacer les filtres
Effacer les filtres

Exiting: Maximum number of function evaluations has been exceeded

13 vues (au cours des 30 derniers jours)
HYZ
HYZ le 10 Sep 2022
Commenté : Sim le 15 Déc 2023
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 commentaires
Walter Roberson
Walter Roberson le 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 le 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.

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 10 Sep 2022
Modifié(e) : Walter Roberson le 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 commentaires
Walter Roberson
Walter Roberson le 15 Déc 2023
Yes, those are my changes, and No, I did not contact Frederic Moisy
Sim
Sim le 15 Déc 2023
Thanks for the information :-)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Linear and Nonlinear Regression dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by