fminunc stopped because it exceeded the function evaluation limit, options.MaxFunEvals = 100000 (the default value).

9 visualizaciones (últimos 30 días)
Hello, I have this discretized functional called F1 (objective multivariable function) and I need to minimize it. Then, I have used FMINUNC to find the minimizer function "x" (solution) and the value of the objective function evaluated in the solution. However, that error occurs. How can I solve i?
function y=F1(U, N)
N=1000;
y = 0;
d = 3/(N-1);
U(1)=2;
U(N)=3;
for j=1:N-2
y = y + (d/2)*((U(j)*(1+((U(j+1)-U(j))/(d))^2)^0.5)+(U(j+1)*(1+((U(j+2)-U(j+1))/(d))^2)^0.5));
end
y = y;
Then;
options = optimoptions(@fminunc,'Display','iter','Algorithm','quasi-newton');
fun = @F1;
v0= ones(1,1000);
[x,fval] = fminunc(fun,v0,options);
fval
  6 comentarios
Walter Roberson
Walter Roberson el 26 de Mzo. de 2021
You (now) have
function y=F1(U, N)
N=1000;
Is there a reason why you overwrite N immediately inside the function?
It seems to me that it would make more sense for you to have
function y = F1(U)
N = length(U);
Walter Roberson
Walter Roberson el 26 de Mzo. de 2021
There is a minima of -infinity at careful combinations of 0 and -infinity .

Iniciar sesión para comentar.

Respuestas (1)

Chidvi Modala
Chidvi Modala el 31 de Mzo. de 2021
You may refer to the following documentation on how to resolve this issue

Categorías

Más información sobre Solver Outputs and Iterative Display 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