function prolozeni
x=[1:8];
y=[10,15,20,22,23,24.5,25,25.3];
plot(x,y,'h');
grid
k3=polyfit(x,y,3);
k2=polyfit(x,y,2);
k8=polyfit(x,y,8);
disp('koeficienty')
disp(k2)
xj=[0.5 : 0.01 : 8.5];
hp3=polyval(k3,xj);
hp2=polyval(k2,xj);
hp8=polyval(k8,xj); % nevhodne
hs=interp1(x,y,xj,'spline');
hold on
plot(xj,hp3,'r--')
plot(xj,hp2,'k--')
plot(xj,hp8,'c--')
plot(xj,hs,'m--')
legend('body','pol. 3.st','pol. 2.st','pol. 8.st',...
    'spline','Location','SouthEast')
hold off
end

