Scatter Plot Curve Fitting!!

조회 수: 5 (최근 30일)
Selen
Selen 2014년 5월 27일
댓글: Star Strider 2014년 5월 27일
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!

답변 (1개)

Star Strider
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
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.
Star Strider
Star Strider 2014년 5월 27일
Agreed.
That’s the reason I suggested stopping at half that, or 5.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Fit Postprocessing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by