Scatter Plot Curve Fitting!!
5 次查看(过去 30 天)
显示 更早的评论
Hi,
I am trying to find a curve that goes through the scatter plot below. It would be great if the curve can minimize the error. There is no polynomial order or fittype restriction.
Thanks!
0 个评论
回答(1 个)
Star Strider
2014-5-27
In such an unrestricted situation, simply use polyfit and its friends polyval and others (all linked to at the end of the page).
I suggest you start with a line (degree 1) and increase the order of the polynomial fit to get one that makes sense to you but does not ‘overfit’ your data.
If you want to minimise the error, calculate the sum-of-squares of the residuals with each increase in order. (You can actually put this in a loop if you like.) When they’re small enough and you’re happy with the way it looks, stop. Something less than a 5th degree polynomial will likely be optimal.
2 个评论
John D'Errico
2014-5-27
Be careful here. It is easy to overfit a polynomial model, using too high of a degree. In this case, you have 11 unique data points, so a 10th degree polynomial is theoretically the highest order curve you could fit to it and get something rational out if it. However, even there you will find that is too high of a degree in general. Such a curve fit will probably do wild and wooly things between the points.
You can also use my SLM toolbox (found on the file exchange) for a fit. It is designed to incorporate your knowledge of the process into the curve fit.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Fit Postprocessing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!