Anonymous user
Composite Trapezoid Rule: Difference between revisions
no edit summary
No edit summary |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
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 =
result = 0.5*f(a) + 0.5*f(b);
for i = 1:(n-1)
result = result + f(a + i*
end
integral =
end
|