# Thread: Problem with FindFit[]

1. ## Problem with FindFit[]

Hi, I want lines of best fit with seriers of measurements.
I have to find a line that suits to a + b Sin x + c Cos x,
here's my try:
Code:
me = {{1., 0.909297}, {1.33333, 0.723086}, {1.66667, 0.397273}, {2.,
0.24112}, {2.33333, -0.190568}, {2.66667, -0.381277}, {3., \
-0.716802}, {3.33333, -1.04901}, {3.66667, -0.958955}, {4., \
-0.998924}, {4.33333, -0.753329}, {4.66667, -0.398198}, {5., \
-0.399415}, {5.33333, -0.109873}, {5.66667, 0.314151}, {6.,
0.496987}, {6.33333, 0.887497}, {6.66667, 0.942508}, {7.,
0.849358}, {7.33333, 0.787294}, {7.66667, 0.567551}, {8.,
0.292118}, {8.33333,
0.0513172}, {8.66667, -0.319537}, {9., -0.464021}, {9.33333, \
-0.788616}, {9.66667, -0.746396}, {10., -1.03999}, {10.3333, \
-0.8235}, {10.6667, -0.683143}, {11., -0.536573}, {11.3333, \
-0.330934}, {11.6667, 0.260128}, {12., 0.260167}, {12.3333,
0.733952}, {12.6667, 1.05134}, {13., 1.03061}, {13.3333,
0.860821}, {13.6667, 1.02306}, {14., 0.830288}};
aa = a + b Sin x + c Cos x;
FindFit[me, aa, {a, b, c}, x]
Complaining: FindFit::fitm: Unable to solve for the fit parameters; the design matrix is nonrectangular, non-numerical, or could not be inverted.
It's complaining something which I don't have any clue about, so any help is appreciated!

2. Specify Sin[x] and Cos[y]:

aa = a + b Sin[x] + c Cos[x];
myFun = FindFit[me, aa, {a, b, c}, x]
Show[{ListPlot[me], Plot[aa /. myFun, {x, 0, 14}]}]

3. Originally Posted by shawsend
Specify Sin[x] and Cos[y]:

aa = a + b Sin[x] + c Cos[x];
myFun = FindFit[me, aa, {a, b, c}, x]
Show[{ListPlot[me], Plot[aa /. myFun, {x, 0, 14}]}]
Thanks alot, man!