Jump to content

Composite Trapezoid Rule: Difference between revisions

no edit summary
No edit summary
 
Line 1:
In numerical analysis, the trapezoidal rule is used for approximation of a definite integral. The code here is a general purpose code for any equation.
[https://en.wikipedia.org/wiki/Trapezoidal_rule]
 
 
== MATLAB ==
 
function integral = trapezoidaltrapezoid(f, a, b, n)
x = (b-a)/n;
result = 0.5*f(a) + 0.5*f(b);
Cookies help us deliver our services. By using our services, you agree to our use of cookies.