If I understand correctly the problem can be recast to the following
A*W = B*H = F;
[a11 a12; a21 a22]*[w1 w2 0 0; 0 0 w3 w4] = [f11 f12 f13 f14; f21 f22 f23 f24];
If so, it is possible to write it in terms of another linear system
A0*w0 = f0;
[A 0 0 0; 0 A 0 0; 0 0 A 0; 0 0 0 A]*[w1 0 w2 0 0 w3 0 w4]' = [f11 f21 f12 f22 f13 f23 f14 f24];
Where A0 is 8x8, w0 is 8x1 and f is 8x1.
This is actually a over determined system, because some of the unknowns (at positions 2 4 5 and 7) are actually zeros, so we can delete the corresponding cols of A0, having a 8x4 matrix. This can be solved with backslash, which gives the linear least squares solution. I don't have the actual matrices, so I play with dummy values
A = eye(2)+rand(2);
F = rand(2,4);
A0 = blkdiag(A,A,A,A);
f = F(:);
A0(:,[2 4 5 7]) = [];
w = A0\f
w1 = [W(1) W(2)];
w2 = [W(3) W(4)];
hope it helps
2 Comments
Direct link to this comment
https://la.mathworks.com/matlabcentral/answers/508679-how-to-find-the-optimal-value-of-a-matrix-that-minimize-a-function#comment_804725
Direct link to this comment
https://la.mathworks.com/matlabcentral/answers/508679-how-to-find-the-optimal-value-of-a-matrix-that-minimize-a-function#comment_804725
Direct link to this comment
https://la.mathworks.com/matlabcentral/answers/508679-how-to-find-the-optimal-value-of-a-matrix-that-minimize-a-function#comment_804732
Direct link to this comment
https://la.mathworks.com/matlabcentral/answers/508679-how-to-find-the-optimal-value-of-a-matrix-that-minimize-a-function#comment_804732
Sign in to comment.