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!