curvefitting comparison in Kaleidagraph and Matlab
10 views (last 30 days)
Show older comments
Hello
At the moment I'm curve fitting longitudinal growth data into a non-parametric model containing 8 parameters.
At first I used kaleidagraph. A curve fitting program using the levenberg-marquardt algorithm. (as to vary between the inverse Hessian method and the steepest descent method). Starting values are putting in and minimization proceeds iteratively.
Trying to reproduce this using matlab i've tried following code opts = optimoptions(@lsqcurvefit, 'Algorithm', 'levenberg-marquardt','DerivativeCheck','on','FinDiffType', 'central','scaleproblem','Jacobian'); [personalParams,personalRes,personalResidual] = lsqcurvefit(heightModel,initialValues,personalData(:,1),personalData(:,2),[],[],opts);
In the opts command only the algoritm has stayed the same, for the rest I've tried to make a lot of the combinations I could make.
But if i compare the function parameters obtained from matlab or kaleidagraph, results vary dramastically. Curve fitting is however comparable.
How can I make sure that both curve fitting procedures will give an exact match. I've looked into some data as how the curve fitting occurs but maybe someone can give me pointers?
I'm a biologist so my background in mathematics is not this big.
Thanks in advance
Niels
0 Comments
Answers (1)
Alan Weiss
on 19 Aug 2013
I doubt that you can get two different implementations, the lsqcurvefit one and the Kaleidagraph one, to take the same iterations. Sorry.
You can examine the lsqcurvefit code to see exactly what it is doing:
edit lsqcurvefit
When you come to a subroutine, such as lsqncommon, click the subroutine name and hit control-D to see that code, too. But I doubt that Kaleidagraph makes its code available to its users, so this might not help you in any case.
I am not really sure what sort of assurance you are looking for. Perhaps if you tell us what you really want (provably optimal parameters? fit guaranteed to be within 1% of optimum? ISO certification of underlying algorithm?) then we might be able to suggest something.
Alan Weiss
MATLAB mathematical toolbox documentation
3 Comments
Alan Weiss
on 21 Aug 2013
lsqcurvefit treats all parameters symmetrically. So I do not think that it is the case that the "latest parameter" has any special significance.
You might want to check this section of the documentation for suggestions on how to improve your fit. In particular, the starting point is very important for many nonlinear fitting problems, and it is possible that your problem would benefit from trying a variety of starting points. If you have Global Optimization Toolbox, the MultiStart solver can try these points automatically. Be sure to give sensible bounds on all components.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
See Also
Categories
Find more on Least Squares in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!