Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Remien sum
Date: Sun, 22 Aug 2010 23:15:24 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 12
Message-ID: <i4sb2c$a7b$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1282518924 10475 172.30.248.35 (22 Aug 2010 23:15:24 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 22 Aug 2010 23:15:24 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2430764
Xref: news.mathworks.com comp.soft-sys.matlab:664131

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.