Find the solution of the given equation using the Trapezoidal rule:
int(5, - 2) sqrt(x^2+1)
Take the number of intervals to be 10.
% range of integration
a = 5;
b = -2;
N = 10; % Step number
dx = (b-a) / N;
 % Function to integrate
 f = @(x) sqrt(x^2+1);
 val = 0;
 for i=1:N-1
     x = a +i*dx;
     val = val + f(x);
 end
 val = val + (f(a) + f(b)) / 2;
 int = val * dx;
 display(int)>> pr01
int =
  -16.9382
Comments