
Compound Trapezoidal Method for Numerical Integration
by admin in Math, Statistics, and Optimization , MATLAB Family , Numerical Integration on April 30, 2019Choose Your Desired Option(s)
×This code calculates the Numerical Integration of a given equation on a predefined interval using Compound Trapezoidal Method. This codes uses variable step size and gives good accuracy.
Code Outputs:
- Chart of Integration History
- Chart of Residuals
- Printed values of Final Iteration value, Accuracy and Number of Iterations.
Result is: 0.86362, Accuracy: 9.8688e-05, NO Iterations: 25
Input Requirements:
- The equation you intended to integrate
- Integration interval [a b].
- predefined error (default 0.0001).
- Maximum number of iterations (default 10000).
About The Method:
Trapezoidal Rule:
In mathematics, and more specifically in numerical analysis, the trapezoidal rule (also known as the trapezoid rule or trapezium rule) is a technique for approximating the definite integral.
The trapezoidal rule works by approximating the region under the graph of the function as a trapezoid and calculating its area. It follows that
The trapezoidal rule may be viewed as the result obtained by averaging the left and right Riemann sums, and is sometimes defined this way.
Illustration of ‘chained trapezoidal rule’ used on an irregularly-spaced partition of [a, b]. The integral can be even better approximated by partitioning the integration interval, applying the trapezoidal rule to each subinterval, and summing the results. In practice, this ‘chained’ (or ‘composite’) trapezoidal rule is usually what is meant by ‘integrating with the trapezoidal rule’. Let {xk} be a partition of [a, b] such that a = x0 < x1 < … < xn-1 < xn = b and dxk be the length of the k-th subinterval (that is, dxk = xk – xk-1), then
The approximation becomes more accurate as the resolution of the partition increases (that is, for larger N, dxk decreases). When the partition has a regular spacing, as is often the case, the formula can be simplified for calculation efficiency.
Non-uniform Grid:
When the grid spacing is non-uniform, one can use the formula
Uniform Grid:
For a domain discretized into N equally spaced panels, considerable simplification may occur. Let
the approximation to the integral becomes
which requires fewer evaluations of the function to calculate.
Download Details
$4.99
Release Information
-
Price:
$4.99
-
Released:
April 30, 2019
-
Last Updated:
May 28, 2019
Subscribe
Most of the time, we share our discount coupons to our Newsletter Subscribers only. And get products updates also!
Recent Blog Posts
Development of Russian Cars Plat...
389 Views
Reinforcement Learning with MATLAB
288 Views
MATLAB Code For Face Detection
401 Views
LSB Based Image Steganography Us...
530 Views
RGB Image to Grayscale Image Con...
342 Views