looking for a solution for an optimization problem
Mostrar comentarios más antiguos
hi, I am looking for a solution for an optimization problem,
I have a set of non-linear equations and I am looking for positive results, what is the method to follow? an example if possible.
thanks a lot
Respuesta aceptada
Más respuestas (3)
Alan Weiss
el 6 de Feb. de 2020
I think that you need to be more careful when trying to follow the example. EITHER use fmincon OR use lsqnonlin, not both. The fmincon workflow:
fun = @(x)0;
The nonlinear constraint function is nlcon at the end of this example.
Set lower bounds of zero.
lb = zeros(3,1);
Run fmincon starting from [0.1;0.1;0.1];
x0 = 0.1*ones(3,1);
[x,fval,eflag] = fmincon(fun,x0,[],[],[],[],lb,[],@nlcon)
This finds the solution you want.
Alan Weiss
MATLAB mathematical toolbox documentation
function [c,ceq] = nlcon(x)
c = [];
ceq = [x(1)^2 - 1;
x(2)^2 - 4;
x(3)^2 - 9];
end
Zinedine Gueddal
el 8 de Feb. de 2020
0 votos
Zinedine Gueddal
el 8 de Feb. de 2020
0 votos
1 comentario
Alan Weiss
el 9 de Feb. de 2020
I'm sorry, but I do not understand what you are asking. Are you saying that different input data yields different results, and some of those results are not satisfactory? Or are you saying that you tried running another program and it gave better results? Or are you asking something else?
Alan Weiss
MATLAB mathematical toolbox documentation
Categorías
Más información sobre Systems of Nonlinear Equations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!