Customising the lsqcurvefit function for an user defined error metric??
10 views (last 30 days)
Show older comments
I am currently trying to use a Levenberg-Marquardt solver with the lsqcurvefit function for the registration(Minimization stage) of 2 point clouds.
I am able to modify the objective function of the lsqcurvefit, and obtain a good fit.
But for my application, I would like the change the error metric on which the solver works on. If I my understanding is right, the solver works on minimizing the squared deviations between the 2 data sets. I would like to add another term into the error, and let the solver minimize the new error metric. Does the lsqcurvefit allow such modifications?
Thank you in advance!
2 Comments
Torsten
on 11 Aug 2017
Which kind of error modification do you want to introduce ?
Best wishes
Torsten.
Accepted Answer
Torsten
on 11 Aug 2017
Use "lsqnonlin" instead of "lsqcurvefit" and define the f_i as
f_i = sqrt(w_i)*(y_i-ydata_i)
where w_i is the weight for the deviation of the ith data point.
Best wishes
Torsten.
3 Comments
Torsten
on 11 Aug 2017
But multiplying the residual vector by the weights is just
res=res.*sqrtw
where "sqrtw" can be set before the call to "lsqnonlin" and passed to the residual function as an argument. This should not take that much time.
Best wishes
Torsten.
More Answers (0)
See Also
Categories
Find more on Linear 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!