Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

I need an algorithm to best-fit a curve

  1. May 29, 2012 #1
    I'm making an applet for distance runners that predicts their finish time for any distance, using recent race times for any distance. For example, a user might enter 3 recent race times which are 16:37 for a 5k (5:21 min/mile pace), 27:42 for an 8k (5:34 min/mile pace), and 35:18 for a 10k (5:41 min/mile pace), then my "finish time calculator" could predict their finish time for a race of any distance. I've found that distance vs. pace follows a logistic curve like the one pictured below.

    http://luna.cas.usf.edu/~mbrannic/files/pmet/image329.gif [Broken]

    Hence I want to predict their race finish times using a logistic function f(x) = C1(1/(1+C2e-C3x)). How do I do this, though?
    Last edited by a moderator: May 6, 2017
  2. jcsd
  3. May 29, 2012 #2
    Standard non-linear regression problem. Any statistics software (e.g. R) will let you fit the curve fairly easily.
  4. May 30, 2012 #3
    I was actually gonna recreate the algorithm in Javascript since I'm putting this "finish time calculator" on a site.
  5. May 30, 2012 #4


    User Avatar
    Homework Helper

  6. Jun 11, 2012 #5
    You could try Lagrange Interpolation.
    Although it may have divergence, it will certainly pass through those points.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook