How can I decompose a matrix into a weighted sum of other matrices?
2 views (last 30 days)
Show older comments
Firstly: I am not very good at MatLab...
I have four normalized matrices, A, B, C, and D and I need to find scalars x, y, and z so that the sum (x*B + y*C + z*D) - A is minimized. Meanwhile: 0<x>1, 0<y>1, 0<z>1 and x+y+z=1.
I have tried lsqcurvefit but it doesn't seem to be able handle the last constraint.
2 Comments
Image Analyst
on 26 Sep 2014
What do you mean by sum()? The expression "x*B + y*C + z*D" is a 2D matrix, so what are you summing? If you sum all the elements of that matrix, A had better be a scalar. If you use sum() it will sum all the columns, so A had better be a row vector. Or maybe you don't want the sum() function to be called at all and just minimize the whole expression (which is already a sum) "x*B + y*C + z*D - A". Please clarify.
John D'Errico
on 26 Sep 2014
Edited: John D'Errico
on 26 Sep 2014
Not a question of not being good at MATLAB. But you need to be better at explaining the problem. What does this mean:
sum (x*B + y*C + z*D) - A
If B,C,D are all matrices of the same size as A, then what do you intend to sum? As you have written it, this expression does not make sense.
And minimize is a poor term to use here, as the "minimum" may well be at x=y=z=0.
Are you asking to best approximate A as a linear combination of the other three? If so this is trivial to do, but it is in no way indicated by the expression you have written. So unless you can be clear, we cannot answer anything with any degree of intelligence.
Answers (0)
See Also
Categories
Find more on Linear Algebra in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!