Good non linear Regression

조회 수: 8 (최근 30일)
Jessica Larry
Jessica Larry 2020년 4월 30일
댓글: Alex Sha 2020년 5월 1일
I have the following data:
x = [15, 25, 35, 45, 55, 65, 75]
y = [22.3, 27.5, 28.8, 29.9, 29.6, 27.4, 23.3]
How could I create a good regression that would fit the data above best. I'm trying to plot them both on the same graph so you can see the different between both lines.
  댓글 수: 4
Ameer Hamza
Ameer Hamza 2020년 5월 1일
Is this result also from 1stOpt? Did you specify the equation or the toolbox is also able to find a suitable equation to fit the data points automatically? I have never tried it, so I am not aware of all the features.
Alex Sha
Alex Sha 2020년 5월 1일
There is also a function in 1stOpt in which the best fit model function could be serached automatically according to the data user provided.

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

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 4월 30일
편집: Ameer Hamza 2020년 4월 30일
One option is to use smoothingspline option from the curve fitting toolbox
x = [15, 25, 35, 45, 55, 65, 75];
y = [22.3, 27.5, 28.8, 29.9, 29.6, 27.4, 23.3];
model = fit(x(:), y(:), 'smoothingspline');
plot(x, y, 'r+');
hold on
xv = linspace(min(x), max(x));
plot(xv, model(xv), 'b-');
  댓글 수: 2
Jessica Larry
Jessica Larry 2020년 4월 30일
편집: Jessica Larry 2020년 4월 30일
I was able to resolve it, thank you so much for the help!!
Ameer Hamza
Ameer Hamza 2020년 4월 30일
Glad to be of help.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Linear and Nonlinear Regression에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by