Exiting: Maximum number of function evaluations has been exceeded

13 次查看(过去 30 天)
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 个评论
Walter Roberson
Walter Roberson 2022-9-10
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 2022-9-10
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.

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2022-9-10
编辑:Walter Roberson 2022-9-10
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 个评论

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Interpolation 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by