- #1
- 17
- 0
Hi
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 don't 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.
So
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?
Thanks
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 don't 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.
So
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?
Thanks