Anonymous user
Composite Trapezoid Rule: Difference between revisions
no edit summary
m (→MATLAB) |
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 =
x = (b-a)/n;
result = 0.5*f(a) + 0.5*f(b);
|