How to fix one point with no error while curve fitting
Show older comments
I have a data to fit linear plot. But I want to fit the first point with no error. I mean, the fitted curve should fix on the first point and then fit to the rest of the point in 'least square fit' method. How can I do that?
Accepted Answer
More Answers (1)
Matt J
on 9 Jun 2014
It depends on the model function for your curve. Ideally, you would choose the formula for the curve to be such that it passes through the desired point. For example, the following linear curve function has unknown slope parameter m, but is written so that it always passes through the known point (x0,y0)
y=m*(x-x0)+y0
If the formula for your model is not tractable enough for this, you may need to use fmincon to do the curve-fitting and specify your constraint using the nonlcon argument.
1 Comment
John D'Errico
on 10 Jun 2014
+1
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!