fminunc stopped because it exceeded the function evaluation limit, options.MaxFunEvals = 100 (the default value).
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
hizaki
am 22 Mai 2014
Kommentiert: hizaki
am 22 Mai 2014
what should i do if i get this kind of error?
0 Kommentare
Akzeptierte Antwort
George Papazafeiropoulos
am 22 Mai 2014
Define the objective function by setting its output with the opposite sign as follows:
function F=fun(x)
F=-0.2662*x.^6+48.19*x.^5-3424.2*x.^4+121708*x.^3-2*exp(6)*x.^2+2*exp(7)*x-6*exp(7);
F=-F;
end
The initial function that you presented does not have a finite global minimum, it tends to -inf due to the negative sign at the coefficient of x^6. The above function has a global minimum, so if you execute the code:
x0 = 1;
[x, fval] = fminunc (@fun,x0)
then the algorithm finds the local minimum of -fun, therefore the global maximum of fun.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Nonlinear Optimization 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!