polynomials fitting
조회 수: 2 (최근 30일)
이전 댓글 표시
hi if i want to use polyfit and polyval for two vectores x and y do they must be at the same size?? in my case x is greater than y by one and i want to predict the value of y at that point wt can i do????
댓글 수: 0
채택된 답변
Ben Mitch
2011년 5월 25일
say you have
x = [1 2 3 4];
y = [8 12 16];
then you can fit a polynomial to the region you have data for (the first three samples) using
p = polyfit(x(1:length(y)), y, 1);
and estimate all the samples using
y_est = polyval(p, x);
or just the ones you don't have data for using
y_est = polyval(p, x(length(y)+1:end));
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Polynomials에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!