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

Homework Help: Curve fitting and least squares method.

  1. Mar 25, 2008 #1
    1. The problem statement, all variables and given/known data

    I have an equation as a function of time. (eq1) C(t) = Css + a(e^.5t) + b(e^.9t) t>0

    Where, Css is a constant. then I have 6 data points of time and C (Concentration of a liquid)

    1. I have to find an equation to find the maximum time and contains a, b and Css.
    2. I have to show the complete least squares derivation based on equation 1 as the approximating function.

    First of all, I'm wondering what the difference between 1 and 2 are... both are ways to find tmax. Also, when doing a least squares method, I don't know exactly how to decide what to type of equation to choose to find my a, b and Css. Will a polynomial work since this function involves exponentials... and how would i decide what degree polynomial to use? Since I should have 3 systems of equations should I go up to a third degree polynomial?
    1. The problem statement, all variables and given/known data

    2. Relevant equations

    3. The attempt at a solution
  2. jcsd
  3. Mar 26, 2008 #2
    Hi, I have an update!

    For part 1. I realized from long ago that the max and mins of a function occur when y'=0

    So I took the derivative of the function which gave me

    C(t) = Css + a(e^.5t) + b(e^.9t) t>0

    c'(t)= .5a(e^.5t)*(e^.5t) + .9b(e^.9t)*(e^.9t) = 0

    i took the ln of the whole thing

    and that gave me

    [ln(.5a)*.5t + .5t] + [ln(.9b)*.9t + .9t] = 0

    my question now is can use the property that ln(xy) = ln(x)+ln(y) to combine the two ln's and thereby combining the coeffiecients of t such that it is .5t+.9t = .14t

    and the whole thing would be .14t*ln(.45ab)= -.14t

    ....... that seems to be wrong considering that the t's cancel out but I can't think of much else...
  4. Apr 2, 2008 #3


    User Avatar
    Homework Helper

    If you are still looking for help, you need to look at the purpose of least squares, which is to minimize the sum of the squares of the vertical distance between the data points and the fitting function:

    [tex]min \ g= \sum_{i=1}^n[f(a,b,t_i) - y_i]^2[/tex]

    Where a and b are the unknown coefficients of the fitting function. To minimize, take the partial derivative of g with respect to each unknown. When terms are collected, the result is a set of simultaneous linear equations that can be solved for a and b.
    Last edited: Apr 2, 2008
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook