How to solve a nonlinear least square problem with constraints
Mostrar comentarios más antiguos
Hello,
I'm using to function lqsnonlin to solve a nonlinear least square problem. Additional to the upper bound I need a constraint with notation 2*mu*kappa-sigma^2>=0. I have four Parameters: mu, Sigma, kappa,y0. Do someone have an idea how i could add this constraint? Or should i better use another function than lqsnonlin?
I would be very greatful for each advise.
Respuestas (3)
Alan Weiss
el 16 de Sept. de 2013
Editada: Alan Weiss
el 16 de Sept. de 2013
I am not sure what that constraint means in terms of your decision variables (the variables you adjust to achieve an optimum). If mu, Sigma, kappa, and y0 are your decision variables, then this is a nonlinear constraint, and the only solver that addresses problems with nonlinear constraints is fmincon.
You would include the constraint as follows (I assume that the vector x is [mu, Sigma, kappa, y0]):
function [c,ceq] = confun(x)
ceq = []; % no equality constraint
c = x(2)^2 - 2*x(1)*x(3); % sigma^2 - 2*mu*kappa <= 0
You would also have to change your objective function to be the sum of the squares of your current vector-valued objective function.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
Anastasia
el 28 de Sept. de 2013
0 votos
Alan Weiss
el 30 de Sept. de 2013
You wrote
function [c] = mycon(x)
c = [x(3)^2-2*x(2)*x(1)];
ceq=[];
But you called the nonlinear constraint function myfun , not mycon , in fmincon:
[x,fval]=fmincon(@KalibrierungCIR,x0,[],[],[],[],lb,[],@myfun)
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!