solve a linear equation system with box constrains

1 次查看(过去 30 天)
How can I solve a overconstrained equation System in of the type A*x=b where A is a Matrix, b a vector, x is the solution vector. Each element has a box constrain of the type ci<xi<di. I know there are functions in the optimzation Toolbox, but unfortunatly I don't have it.

采纳的回答

Torsten
Torsten 2015-11-26
min: sum_{i=1}^{n}{a_i^t*x-b_i}^2
Now replace x_j with lb_j*sin^2(y_j)+ub_j*cos^2(y_j) and use fminsearch to solve for the y_j.
Here, lb_j and ub_j are the lower and upper bounds for x_j.
Of course, using lsqlin to solve would be much more safe and efficient.
Best wishes
Torsten.
  1 个评论
Jan Klement
Jan Klement 2015-11-26
Thank you Torsten,
it works slow but it works sufficiently good if the number of function calls is increased. I have tested your aproach against fminsearchbnd from the matlab central and is it always faster. Here the code if someone Needs it:
xt is the solution.
n=100;
lb=rand(1,n)*(-1000);
ub=lb+rand(1,n)*1000;
A=rand(n);
b=rand(1,n);
xr=fminsearch(@(x) afun2(x,A,b,lb,ub),start,optimset('MaxFunEvals',1e5,'MaxIter',1e10));
[ysum y xt]=afun2(xr,A,b,lb,ub);
function [ysum y xt]=afun2(x,A,b,lb,ub)
xt=lb.*sin(x).^2+ub.*cos(x).^2;
y=xt*A-b;
ysum=(norm(y));
end

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Linear Least Squares 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by