% Harjutustund 9, ylesanne 7
x=[2014:1:2021];
y=[22.2,19.5,18.0,17.9,25.2,18.6,18.7,29.3];
disp([x;y])
plot(x,y,'o')
p1=polyfit(x,y,1)
yp1=polyval(p1,x);
disp([x;y;yp1])
hold on
plot(x,yp1)

p4=polyfit(x,y,4)
yp4=polyval(p4,x);
hold on
plot(x,yp4)

polyval(p1,2024)
polyval(p4,2024)