Find the integration $\int_a^b f(x) dx$, using trapezoidal rule.
f = @(x) x.^2; a = 0; b = 1; n = 100; h = (b-a)/n; x = a:h:b; fx = f(x); trap = (2*sum(fx(2:n))+fx(1)+fx(n+1))*h/2
trap = 0.3333
plot(x,fx)
Find the integration $\int_a^b f(x) dx$, using simpson's rule.