function intf=splineq(x,y)
%
% Spline Quadrature
% computes integral of y over x using spline interpolation
% x and y are two vectors of equal size.
%
% example: compute integral of sin(x) from 0 to pi:
%
%          x=[0:0.1:1]*pi; y=sin(x); splineq(x,y)
%
% written by Fabian Waleffe for NEEP271  1998/10/31

pp=spline(x,y);
[x,c,L,k]=unmkpp(pp);

sum=0;

for i=1:L,
    h=x(i+1)-x(i);
    dF=(((c(i,1)*h/4 + c(i,2)/3)*h + c(i,3)/2)*h+c(i,4))*h;
    sum=sum+dF;
end

intf=sum;
