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

Linearing a non-linear problem don't yeild the same solution.

  1. Nov 3, 2011 #1

    I have some data samples and and my job is to find a curve that will fit these values.
    The curve that i have gone for is in the form

    y = k * sqrt(d1^x*d2^y)*d3^z

    where kxyz are all unknowns that I need to find. I solve this with the matlab function fminsearch and the solution is just fine.

    I did also try linearize the problem by log

    log(y) = log(k) + xlog(d1)/2 + ylog(d2)/2 +zlog(n)

    And this i solved with the function lsqnonlin

    I should mention that i use the least square solution sum(Ymeasured-Yanalytical)

    Anyways this brings me to my question. These two dont give the same solution!

    According to wikipedia
    In LLSQ the solution is unique, but in NLLSQ there may be multiple minima in the sum of squares.
    Which means that either I'm doing something wrong or the solution after linearizing isn't necessarily the optimal solution.


    Is the solution of a linear function the optimal solution or not?

    The solution of a non-linear is not unique while it is for a linear function.

    Shouldn't the linear function give the same or a better solution than the non linear?

  2. jcsd
  3. Nov 3, 2011 #2


    User Avatar
    Science Advisor
    Homework Helper

    With your first method you are minimizing [itex]\sum (y_m - y_e)^2[/itex].

    When you take logs, you are minimizing [itex]\sum (\log y_m - \log y_e)^2[/itex].

    That means you will get different answers even when there is a unique solution to the NLLSQ problem.
  4. Nov 3, 2011 #3
    But shouldn't the values of the parameters minimize both functions? Isnt the whole point of you linearizing the function so that you will have the best unique optimum, while the non-linear problem can have more than one solution and the one you have might just be a local minimum.
  5. Nov 3, 2011 #4


    User Avatar
    Science Advisor
    Homework Helper

    Linearizing the function makes it easier to solve, but it also changes the problem.

    Take a similar but simpler problem. Find the value of a that minimizes [itex]y = e^{ax}[/itex].

    The least squares sum is
    [tex]\sum (y_i - e^{ax_i})^2 = \sum y_i^2 - 2y_i e^{ax_i} + e^{2ax_i}[/tex]
    The minimum is when
    [tex]\sum y_ix_i e^{ax_i} = \sum x_i e^{2ax_i}[/tex]

    On the other hand if you take logs and minimize [itex]\log y = a \log x[/itex], the minimum value is just
    [tex]a = \left(\sum \log y_i \right) / \left(\sum \log x_i \right)[/tex].
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook