How can I find the coefficients of this polynomial?

2 次查看(过去 30 天)
I need to find the coefficients of the polynomial that passes through the points (0, 10), (1, 35), (3, 31) and (4, 2).
I appreciate it a lot if anyone can help.

回答(1 个)

Stephan
Stephan 2020-11-17
编辑:Stephan 2020-11-17
x = [0 1 3 4];
y = [10 35 31 2];
coeffs = polyfit(x,y,3)
plot(0:0.1:5,polyval(coeffs,0:0.1:5),'b-')
hold on
scatter(x,y,'bo')
hold off

类别

Help CenterFile Exchange 中查找有关 Polynomials 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by