MATLAB: How to find the coefficients of this polynomial

coefficientcoefficientspointpointspolynomial

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.

Best Answer

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