function sum=trap(a,b,N)
sum=f(a)+f(b);
h=(b-a)/N;
x=a;
for j=2:N-1
  x=x+h;  	
  sum=sum+2*f(x);
end
sum=sum*h/2;
