Results 1 to 3 of 3

Math Help - Matlab help

  1. #1
    Newbie
    Joined
    Mar 2008
    Posts
    21

    Matlab help

    Can anyone sohw me how to do Riemann Integrals Sums on matlab.

    The question I have to do is this:

    Using Matlab, calculate an approximation for the definite integral of
    g(x)
    = 2 − x^3 on the interval [0,4] using 100 equal subintervals.

    What I do is use the command

    rsums(2-x^3,0,4)
    Then I move the bottom to 100 (so that there are 100 subintervals) And on the top it gives me -13.999200

    Is this right? It doesnt seem right. Shouldnt the approximation be closer to -56 (which is what the exact signed area is)? And is there any other way to do it?

    Follow Math Help Forum on Facebook and Google+

  2. #2
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by Johnaloa View Post
    Can anyone sohw me how to do Riemann Integrals Sums on matlab.

    The question I have to do is this:

    Using Matlab, calculate an approximation for the definite integral of

    g(x)
    = 2 − x^3 on the interval [0,4] using 100 equal subintervals.

    What I do is use the command

    rsums(2-x^3,0,4)
    Then I move the bottom to 100 (so that there are 100 subintervals) And on the top it gives me -13.999200

    Is this right? It doesnt seem right. Shouldnt the approximation be closer to -56 (which is what the exact signed area is)? And is there any other way to do it?



    Why are you using Riemann sums when the question does not ask for it.
    I always use the mid point rule for which the code isL

    dx=4/100;
    x=dx/2:dx:4;

    ii=2-x.^3;
    II=sum(transpose(ii))*dx

    Otherwise type "help rsum" at the command line.

    I don't see any point in your using a built in tool to do this, especialy as the graphics appear rather naff.

    RonL
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Mar 2008
    Posts
    21
    Well I feel like an idiot now . Sorry the following question was to do with Riemann sums and thats why I tried to do what I did (and fail pretty badly at that lol).

    Thanks a lot, I got my answer (-57.2864 if you were wondering, I ended up using the right hand end point rule)!
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Matlab help
    Posted in the Math Software Forum
    Replies: 1
    Last Post: February 11th 2010, 03:59 AM
  2. Matlab FFT Help
    Posted in the Math Software Forum
    Replies: 0
    Last Post: June 3rd 2009, 01:48 PM
  3. help about ODE in matlab
    Posted in the Math Software Forum
    Replies: 1
    Last Post: May 31st 2009, 04:10 AM
  4. Matlab Please help me
    Posted in the Math Software Forum
    Replies: 8
    Last Post: November 10th 2008, 05:40 PM
  5. Matlab
    Posted in the Calculus Forum
    Replies: 3
    Last Post: August 20th 2008, 11:39 PM

Search Tags


/mathhelpforum @mathhelpforum