% Tund 13, ülesanne 4
x=[1:0.5:5];
y=[0,10,18,25,32.2,39,43,48,52.3];
plot(x,y,'o')
hold on
trapz(x,y)
xvork=[1:0.001:5];
y3splain=interp1(x,y,xvork,'spline');
plot(xvork,y3splain,'b-')
hold on
f=@(z) interp1(x,y,z,'spline');
integral(f,1,5)
y1splain=interp1(x,y,xvork,'linear');
plot(xvork,y1splain,'g-')
hold off
g=@(w) interp1(x,y,w,'linear');
integral(g,1,5)