# Linear Fit of multidimensional data

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

• LinearSolve[] looks to be better for this. – J. M.'s technical difficulties Aug 31 '15 at 9:42
• 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! – Michael E2 Aug 31 '15 at 9:54