Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Remien sum

Subject: Remien sum

From: Cesar

Date: 22 Aug, 2010 23:15:24

Message: 1 of 3

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.

Subject: Remien sum

From: John D'Errico

Date: 22 Aug, 2010 23:31:06

Message: 2 of 3

"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

Subject: Remien sum

From: Roger Stafford

Date: 22 Aug, 2010 23:35:20

Message: 3 of 3

"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.
- - - - - - - - -
  The assignment is very well stated. It should be easy to carry out. What is your question?

Roger Stafford

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us