trap(a,b,n,f)

Computes integral via Composite Trapezodial Rule between [a,b] with equally spaced points
449 Downloads
Updated 4 Mar 2018

View License

Computes integral via Composite Trapezodial Rule between [a,b] with equally spaced points.
Example:
syms x
fun = x^2+x+1;
a = 0;
b = 1.6180 ;
n = 100;
result = trap(a, b, n, fun)
result =
4.3390

Cite As

Omer Refik Tan (2024). trap(a,b,n,f) (https://www.mathworks.com/matlabcentral/fileexchange/57272-trap-a-b-n-f), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2015b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Numerical Integration and Differential Equations in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.1.0.0

Changed function name to "trap".
Added output and how to use to description and inside the mfile. Thanks Salil Chawla!

1.0.0.0