MATLAB Answers

Solve linear system of equations with constains

2 views (last 30 days)
Xin on 25 Feb 2018
Edited: Matt J on 3 Mar 2018
Hello everyone. I have a linear system of equations that make a matrix, L*x=R. x is composed on many variables, e.g. x=[x1 x2 x3 x4 ... xN]. I want to solve this system of equation with constraints x1>|x2|>|x3|>|x4|...>|xN|. Can I use lsqlin(L,R) with some additional input to realize it?
Many thanks.


Sign in to comment.

Accepted Answer

Matt J
Matt J on 25 Feb 2018
Edited: Matt J on 2 Mar 2018
If you make the change of variables x(i)=u(i)-v(i) with linear constraints
and modify your least squares objective from norm(L(u-v)-R)^2 to
norm(L(u-v)-R)^2 + C*( norm(u)^2 + norm(v)^2)
then for a sufficiently small choice of C>0, this should give an equivalent solution. It's not ideal, since it forces you to re-solve with multiple choices of C, but on the other hand, it allows you to pose this as a convex problem.


Show 5 older comments
Matt J
Matt J on 3 Mar 2018
The modified objective function is linear least squares in [u,v] so lsqlin still applies.
Xin on 3 Mar 2018
I have looked into lsqlin function but did not find how to change the objective. Then how do I change the objective from min 0.5*(NORM(C*x-d)).^2 to min 0.5*(NORM(C*x-d)).^2+ C*( norm(u)^2 + norm(v)^2)?
Matt J
Matt J on 3 Mar 2018
It just requires a different choice of input matrices C,d. For example, the terms
( norm(u)^2 + norm(v)^2)
is the same as
norm( C*[u;v]-d )^2
where C=speye(2*N) and d=zeros(2*N,1).

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by