I've got to solve the linear system AX=B with all three A, X and B being matrices. As constraints, there are equations x_ij + x_kl = 1 for some of the elements of X. Altogether, the system is overdetermined (i.e., columns of A are time series with ~180 time steps, rows of A are 24 parameters, to be mapped down at 4 parameters in B).
Might I get any hint how to enter this in MatLab? I searched through the Optimization Toolbox tutorial but could not find really what I want.
Thanks a lot for helping!
Why not use quadprog() to do find a constrained least squares solution?
lsqlin is far easier to use in this sense, since it takes
the problem in the form of A*x = b, without needing
to reformulate it into the quadprog form.
As far as entering it into matlab, you need to formulate
the problem in the form of
A*X = b
where X and B are (column) vectors. This is the standard
form that lsqlin will require.
John
Let me expand on this a bit. The OP will need to
convert A into a new matrix (sparse!!!!) as well as
form a constraint system that is sparse.
Kron will aid in this task as I recall.
John
Extend your system as block diagonal (put X & B as long vectosr, repeating A on diagonal using KRON or BLKDIAGS for example). The constraints can be formulated as linear. If you have QUADPROG use it, otherwise written the new system in the basis of the orthogonal of the constraints to make the new system unconstrained, then solve using "\".
Bruno
this should be valuable hints for me to get me along. Thanks all for the fast reply, have a nice time!
Christian
I'll still argue that the use of quadprog here is,
while not technically incorrect, it is numerically
improper.
Effectively, in order to use quadprog, one must
form A'*A. You will minimize a quadratic form,
after all. So you are squaring the condition
number of the problem, just as if you had formed
the normal equations.
Use lsqlin instead to avoid that operation. Only
use quadprog when your problem is already in
the nominal form that it is designed for.
John