Borrar filtros
Borrar filtros

Exiting: Maximum number of function evaluations has been exceeded

13 visualizaciones (últimos 30 días)
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 comentarios
Walter Roberson
Walter Roberson el 10 de Sept. de 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 el 10 de Sept. de 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.

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 10 de Sept. de 2022
Editada: Walter Roberson el 10 de Sept. de 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 comentarios
Walter Roberson
Walter Roberson el 15 de Dic. de 2023
Yes, those are my changes, and No, I did not contact Frederic Moisy
Sim
Sim el 15 de Dic. de 2023
Thanks for the information :-)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Linear and Nonlinear Regression en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by