function prolozeni_bodu
x=[1:9];
y=[1:5,4:-1:1];
plot(x,y,'ro')
xj=[0.5:0.1:9.5];
k=polyfit(x,y,3);
disp('koeficienty polynomu')
disp(k)
y3=polyval(k,xj);
y2=polyval(polyfit(x,y,2),xj);
y1=polyval(polyfit(x,y,1),xj);
y5=polyval(polyfit(x,y,5),xj);
y9=polyval(polyfit(x,y,9),xj);
hold on
plot(xj,y3,'k')
plot(xj,y2,'g')
plot(xj,y1,'b')
plot(xj,y5,'c')
plot(xj,y9,'m')
legend('prokladane body','polynom 3.stupne','polynom 2.stupne','polynom 1.stupne','polynom 5.stupne','polynom 9.stupne - nevhodny','Location','North')
hold off
disp('Hodnota v bode 8.5')
disp(polyval(k,8.5))
end


