How to solve a nonlinear least square problem with constraints
이전 댓글 표시
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.
답변 (3개)
Alan Weiss
2013년 9월 16일
편집: Alan Weiss
2013년 9월 16일
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
Alan Weiss
2013년 9월 30일
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
카테고리
도움말 센터 및 File Exchange에서 Systems of Nonlinear Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!