1
$\begingroup$

I am trying to find linear decomposition of vector B (of arbitrary dimension $n$) in the form :

$B = \alpha_{1} C_{1} + \alpha_{2} C_{2} + ...$

where $C_{i}$ are known vectors (of dimension $n$) and $\alpha_{i}$ are scalars (to be determined).

I am trying to do it using LinearFitModel, but I have trouble understanding how it works in my case from the Mathematica documentation. I tried :

X = Transpose[{C1,C2,C3,X}]
f = Transpose[{C1,C2,C3}]
t = Table[i,{i,1,Length[X]}]
LinearModelFit[X,f,t]

but I get the following error :

LinearModelFit::fitm: Unable to solve for the fit parameters; the design matrix is nonrectangular, non-numerical, or could not be inverted.

Has someone experience with this ?

Many thanks in advance,

Cl38

$\endgroup$
2
  • 2
    $\begingroup$ LinearSolve[] looks to be better for this. $\endgroup$ Aug 31, 2015 at 9:42
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$
    – Michael E2
    Aug 31, 2015 at 9:54

1 Answer 1

1
$\begingroup$

This is equivalent to the matrix equation C.x=B, where the columns of C are your vectors Ci. As "Guess who it is" noted, this can be worked with LinearSolve[], or you can RowReduce[] the augmented matrix [C|B] to find a general solution.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.