How to solve a nonlinear least square problem with constraints
Afficher commentaires plus anciens
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.
Réponses (3)
Alan Weiss
le 16 Sep 2013
Modifié(e) : Alan Weiss
le 16 Sep 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
le 28 Sep 2013
0 votes
Alan Weiss
le 30 Sep 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
Catégories
En savoir plus sur Systems of Nonlinear Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!