How to predict using interpolation or polyfit
조회 수: 13 (최근 30일)
이전 댓글 표시
Hi, I have data as below:
x y 1.2 2.3 4.8 2.7 5.8 3.5
and I want to predict for x is 2.7, what is y? Many thanks in advance,
댓글 수: 1
채택된 답변
Akira Agata
2017년 9월 13일
...Or polyfit function, like:
xy = [1.2, 2.3;
4.8, 2.7;
5.8, 3.5];
p = polyfit(xy(:,1), xy(:,2), 2);
x = linspace(0,6);
y = polyval(p, x);
figure
plot(xy(:,1), xy(:,2),'ro');
hold on;
plot(x,y,'b:');
plot(2.7, polyval(p, 2.7), 'bo');
legend({'Data','polyfit','estimated value at x = 2.7'});
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Gaussian Process Regression에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!