Main Content


Interactive evaluation of Riemann sums



rsums(f) interactively approximates the integral of f(x) by middle Riemann sums for x from 0 to 1. rsums(f) displays a graph of f(x) using 10 terms (rectangles). You can adjust the number of terms taken in the middle Riemann sum by using the slider below the graph. The number of terms available ranges from 2 to 128. f can be a character vector or a symbolic expression. The height of each rectangle is determined by the value of the function in the middle of each interval.


rsums(f,a,b) and rsums(f,[a,b]) approximates the integral for x from a to b.


collapse all

Approximate the integral 01x2dx by middle Riemann sum. rsums displays a graph of x2 using 10 terms of the midpoint Riemann sum for the integration range from 0 to 1. The total sum is 0.3325.

syms x

Change the integration range of x from -2 to 5. The total Riemann sum is 44.0475.


Input Arguments

collapse all

Integrand, specified as a symbolic expression, function, or number.

Lower bound, specified as a number or symbolic number.

Upper bound, specified as a number or symbolic number.

Version History

Introduced before R2006a

See Also

| |