Matrix solving via least-squares: Y = A*B where Y, A and B are all matrices

2 vues (au cours des 30 derniers jours)
Scott
Scott le 6 Août 2015
Commenté : Scott le 6 Août 2015
I've been trying to get the lsqcurvefit function to find B such that A*B = Y where B and Y are mxn matrices and A is a mxm matrix of constants. The closest advice I could find is HERE but it doesn't seem to want to work when the "function" is a matrix.
Any advice or direction is greatly appreciated. Is there a better function out there to use? I wrote up a convergence algorithm to solve this but I want to check the results against something that already exists and is proven. Plus, if lsqcurvefit is anything like fit, it'd have the added bonus of returning errors for each value.
  3 commentaires
Scott
Scott le 6 Août 2015
Modifié(e) : Scott le 6 Août 2015
Valid point, I didn't explain it thoroughly enough.
Say we alter B(1,1). This will obviously alter all the values in the first column of Y. The kicker is sum(i,:) for Y and B are locked, thus increasing B(1,1) will increase the values of Y(:,1) and in turn require decreasing of B(1,2:end) and Y(:,2:end).
Thanks for your prompt reply. The lack of information is completely on me. I think, given the conditions, a fitting method perhaps isn't feasible.
John D'Errico
John D'Errico le 6 Août 2015
Modifié(e) : John D'Errico le 6 Août 2015
You could NEVER have used lsqcurvefit to solve the problem anyway, since it does not allow linear equality constraints. As well, lsqcurvefit does not return statistics on the parameters. As Matt points out, lsqlin will solve the problem, however it too does not return the confidence information about the parameters that you wish.

Connectez-vous pour commenter.

Réponse acceptée

Matt J
Matt J le 6 Août 2015
Modifié(e) : Matt J le 6 Août 2015
Since your model is linear and you have linear constraints on B (its row sums), then LSQLIN is the better tool to use
b=lsqlin(C,d,[],[],Aeq,beq);
B=reshape(b,m,n);
where
C=kron(speye(n),A);
d=Y(:);
Aeq=kron(ones(1,n),speye(m));
beq=rowsums;
  1 commentaire
Scott
Scott le 6 Août 2015
That's a huge help, I cannot thank you enough! I was reading through the help file and it appears I can have upper and lower bounds too. Thanks so much for your help!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Interpolation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by