MATLAB – Trapezoidal numerical integration without using trapz
Trapezoidal rule is utilized to discover the approximation of a definite integral. The main idea in the Trapezoidal rule is to accept the region under the graph of the given function to be a trapezoid rather than a rectangle shape and calculate its region.
The formula for numerical integration using trapezoidal rule is:
where h = (b-a)/n
Now we take an example for calculating the area under the curve using 10 subintervals.
Let’s take another example for calculating the area under the curve using 4 subintervals.