How does lsqnonlin fit function to data?
Show older comments
Hello,
I am trying to use lsqnonlin for finding primitives(plane, cone,..etc) parameter such as orientation.
I have primitive's point set P and the function uses primitive equation(ex. plane equation, cylinder equation) to calculate distance between estimated primitive and P. Input x is composed of 3 variables that represents the orientation of primitive(in euler angle).
I've understand lsqnonlin searches optimal x starting from x0.
But how far does it search? Is there a limitation such as searching only near the x0? If the starting value x0 is far from ground truth, will there be problem in finding solution?
If the lsqnonlin consider's every possibility of x, the function should return correct output but it seems to come out wrong.
The code is like below:
options = optimset('Jacobian', 'on', 'Algorithm','trust-region-reflective', 'display', 'off');
x0=[v1 v2 v3];
out = lsqnonlin(@(x)distance2primitive(x, P), x0, [-Inf -pi 0], [Inf pi pi], options);
Accepted Answer
More Answers (0)
Categories
Find more on Get Started with Curve Fitting Toolbox 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!