Results 1 to 3 of 3

Math Help - Problem with FindFit[]

  1. #1
    Newbie
    Joined
    Oct 2009
    Posts
    2

    Exclamation 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!
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Super Member
    Joined
    Aug 2008
    Posts
    903
    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}]}]
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Oct 2009
    Posts
    2
    Quote Originally Posted by shawsend View Post
    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!
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. MATHEMATICA FindFit experimental data
    Posted in the Math Software Forum
    Replies: 6
    Last Post: February 13th 2010, 02:50 PM
  2. findfit mathematica
    Posted in the Math Software Forum
    Replies: 1
    Last Post: December 13th 2009, 02:48 PM
  3. FindFit[]problem
    Posted in the Math Software Forum
    Replies: 2
    Last Post: October 27th 2009, 02:57 AM
  4. Mathematica FindFit - proper format question
    Posted in the Math Software Forum
    Replies: 8
    Last Post: September 27th 2009, 06:59 AM

Search Tags


/mathhelpforum @mathhelpforum