To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016
I m trying to solve XA=B where both A,B are matrix (instead of B being a vector) Using e.g. LU decomposition ('linsolve' or '/') is possible to obtain such a solution.
However i need to constrain X>0.
Is this an optimization problem (min(||XA-B||),X>0,B), and if it is can someone propose a suitable function ?
No products are associated with this question.
Solving for each row of X is an independent optimization problem that can be solved easily with LSQNONNEG (available from the Optimization Toolbox). Use a loop to solve for each row independently.
Example 1 (test when know the exact answer):
% Set up some data A = rand(5); Xtrue = rand(5); B = Xtrue*A;
% Solve for each row of X using LSQNONNEG X = ; for k = 1:size(B,1) X(k,:) = lsqnonneg(A',B(k,:)'); end
% Verify the result X - Xtrue
A = rand(6,3); B = rand(6,3);
X = ; for k = 1:size(B,1) X(k,:) = lsqnonneg(A',B(k,:)'); end
% Verify that all X are positive X
Note that if your data is very big, this algorithm could easily be sped up by running it in parallel.
does this answer help? http://www.mathworks.com/matlabcentral/answers/24086-ols-regression-for-multiplr-ys-xs