|
"Cesar " <celny516@aol.com> wrote in message <i4sb2c$a7b$1@fred.mathworks.com>...
> Riemann Sum M-file: Write a function M-file for a function myriemann which takes four arguments f, a, b and n. You may assume that f is a continuous function on [a,b] and that a < b. Calculate and print the value of the left sum, right sum and midpoint sums of the function f on the interval [a,b] using n subintervals. Display the text:
> Left sum = ...
> Right sum = ...
> Midpoint sum = ...
>
> Suggested outline:
> Initiate three variables L, R and M all to zero. These will contain your sums as you go.
> Calculate the subinterval size.
> Start a for loop.
> Add the appropriate values to L, R and M by multiplying the interval width by the appropriate height and adding.
> End the for loop.
> Return 0.
So what have you done to solve your homework problem,
besides posting the assignment?
John
|