fit a second order polynomial to the data given in table 2
Answers
Given : Values of x and y
To Find : a second order polynomial
Solution:
x y
0 2.1
1 7.7
2 13.6
3 27.2
4 40.9
5 61.1
a second order polynomial
y = 1.860x² + 2.359x + 2.478
R² = 0.998
Learn More:
Which two points should the line of best fit go through to best ...
brainly.in/question/16164800
Payton collected data to show the relationship between the number ...
brainly.in/question/16174097
Answer: n=input('Number of sets of points : ');
%taking input
for i=1:n
x(i)=input('X(i):');
y(i)=input('Y(i):');
end
%calculating coefficients
sumx=0;
sumy=0;
sumxy=0;
sumxsq=0;
for i=1:n
sumx=sumx+x(i);
sumy=sumy+y(i);
sumxy=sumxy+x(i)*y(i);
sumxsq=sumxsq+x(i)^2;
end
format long ;
%calculating a1 and a0
a1=(n*sumxy-sumx*sumy)/(n*sumxsq-sumx^2) a0=sumy/n-a1*sumx/n
%plotting observed data
plot(x,y,'o')
hold on;
%plotting fitted data
ym=a0+a1.*x;
plot(x,ym);
Step-by-step explanation: