fitting a polynomial function to data points and ploting it
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi all
I want to fit a quadratic function to a data serie in MATLAB and calculate determination coefficient (R2) as well as quadratic equation.so desired outputs are as below: - scatter plot of data serie i.e. (x, y) - plot of quadratic fitting - quadratic equation - determination coefficient (R2) Could you please guide me. thanks
댓글 수: 0
채택된 답변
Richard Willey
2011년 11월 7일
If you have Curve Fitting Toolbox, you can generate everything you need as follows
X = 1:100;
X = X';
Y = X.^2 + 3*X + 5 + randn(100,1);
[foo Gof] = fit(X,Y, 'poly2')
scatter(X,Y)
hold on
plot(foo)
댓글 수: 0
추가 답변 (1개)
Pawel Blaszczyk
2011년 11월 7일
doc polyfit
doc polyval
I think this two function will be enoguh :)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Linear and Nonlinear Regression에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!