Results 1 to 7 of 7
Like Tree1Thanks
  • 1 Post By ILikeSerena

Math Help - curve fitting

  1. #1
    Newbie
    Joined
    Dec 2012
    From
    Zurich
    Posts
    3

    curve fitting

    Hi everybody!

    I'm trying to find a function that i could fit to only a few datapoints

    x = [10 50 90 100]
    y= [0.77 0.75 0.55 0.51]

    I have troubles finding a function with only one or two free parameters to fit.
    I got stuck with something like:

    y(x)= 1 - exp(k*x)

    What do you guys think? What would be the best function?
    Thanks in advance!!
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Senior Member jakncoke's Avatar
    Joined
    May 2010
    Posts
    387
    Thanks
    80

    Re: curve fitting

    Assume there is a cubic equation of the form
     f(x) = a_3 x^3 + a_2  x^2 + a_1 x + a_0

    for which


    f(10) = a_3 (10)^3 + a_2 (10)^2 + a_1 (10) + a_0
    f(50) = a_3 (50)^3 + a_2 (50)^2 + a_1 (50) + a_0
    f(90) = a_3 (90)^3 + a_2 (90)^2 + a_1 (90) + a_0
    f(100) = a_3 (100)^3 + a_2 (100)^2 + a_1 (100) + a_0


    Since you know f(10), f(50), f(90), f(100), this equals solving a matrix


     \begin{bmatrix} 10^3 && 10^2 && 10 && 1 \\ 50^3 && 50^2 && 50 && 1 \\ 90^3 && 90^2 && 90 && 1 \\ 100^3 && 100^2 && 100 && 1 \end{bmatrix}  \begin{bmatrix} a_3 \\ a_2 \\ a_1 \\ a_0 \end{bmatrix}=  \begin{bmatrix} .77 \\ .75 \\ .55 \\ .51 \end{bmatrix}

    So, solving that, i got a polynomial


     f(x) = .000000847 x^3 + -.000183 x^2 + 0.007873611111111113 x^1 + 0.7087500000000001


    You can verify, it fits the points perfectly.
    Last edited by jakncoke; December 21st 2012 at 05:19 PM.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Super Member
    Joined
    Jun 2009
    Posts
    660
    Thanks
    133

    Re: curve fitting

    You could try a graphical approach.

    Rewrite your equation as 1-y = exp(kx) and take logs.

    That gets you ln(1-y) = kx which can be rewritten as Y=kx, where Y=ln(1-y).

    If you now plot Y against x you should get a straight line. If the points do lie roughly along a straight line, (which should pass through the origin), then OK., and the slope of the line will be the value of k. If they don't then your equation doesn't work and it's back to the drawing board. Try something else.

    The problem with the cubic in the last response is that it will have two turning points and these, (I haven't checked for this case) usually fall within the data points. The curve may well pass throught the data points but it can hardly be said to give a smooth (predictive) representation of the data.
    Last edited by BobP; December 22nd 2012 at 12:34 AM.
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Super Member ILikeSerena's Avatar
    Joined
    Dec 2011
    Posts
    733
    Thanks
    121

    Re: curve fitting

    Hi bottlerocket66!

    With so few points and without any information about the expected relation, the best curve is a straight line.
    That is the simplest shape that makes no assumptions.
    Anything else is just obscuring whatever it is for.

    What is it for?
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Newbie
    Joined
    Dec 2012
    From
    Zurich
    Posts
    3

    Re: curve fitting

    Hi ILikeSerena!

    Thanks for your reply. The data points are from a simple economic choice experiment.
    They indicate how the value of a good is discounted. 1 being the value of the good. 0.77 means that it has decreased in value by that factor.
    I'm looking for a function that takes into account the curvature and it should be a monotonically decreasing function.
    The fitted free parameter(s) of the function should then say something about the individual degree of discounting (amount of curvature).
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Newbie
    Joined
    Dec 2012
    From
    Zurich
    Posts
    3

    Re: curve fitting

    These are some other datapoints
    x = [10 50 90 100]
    y= [0.7700 0.7500 0.6000 0.5000]
    Follow Math Help Forum on Facebook and Google+

  7. #7
    Super Member ILikeSerena's Avatar
    Joined
    Dec 2011
    Posts
    733
    Thanks
    121

    Re: curve fitting

    Quote Originally Posted by bottlerocket66 View Post
    Hi ILikeSerena!

    Thanks for your reply. The data points are from a simple economic choice experiment.
    They indicate how the value of a good is discounted. 1 being the value of the good. 0.77 means that it has decreased in value by that factor.
    I'm looking for a function that takes into account the curvature and it should be a monotonically decreasing function.
    The fitted free parameter(s) of the function should then say something about the individual degree of discounting (amount of curvature).
    For the way a good is discounted, I would expect a relation like y=y_0 e^{-  x / \tau}, where \tau is the so called characteristic time, and y_0 is the value at x=0.

    Looking at your data, that does not seem to match.
    Just to mention a couple of other possible relationships:

    y=y_0 e^{- (x / \tau)^2}

    y=\frac {y_0} { (x / \tau)^2 + 1}

    With both of these relations you can get a pretty good match.
    Thanks from bottlerocket66
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Curve Fitting
    Posted in the Advanced Algebra Forum
    Replies: 11
    Last Post: November 23rd 2010, 03:55 PM
  2. Curve Fitting
    Posted in the Calculus Forum
    Replies: 8
    Last Post: September 15th 2010, 02:09 PM
  3. Curve Fitting 2
    Posted in the Calculus Forum
    Replies: 8
    Last Post: September 15th 2010, 06:38 AM
  4. Fitting a curve to a form
    Posted in the Advanced Statistics Forum
    Replies: 1
    Last Post: May 12th 2009, 05:43 PM
  5. Curve fitting
    Posted in the Math Software Forum
    Replies: 7
    Last Post: November 27th 2008, 04:21 AM

Search Tags


/mathhelpforum @mathhelpforum