Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Using Matlab for integration

  1. Dec 12, 2004 #1
    I used matlab to calculate the integration of a basic function.
    I wrote :

    F = inline('(2*x)+((x.^3)/0.000441)')

    Q = quad(F,0.01,0.05)

    I want to calculate integral of F from 0.01 to 0.05
    the answer shown is 0.059
    but the real answer is 0.361

    I am sure the function F is correct (I have tried some values).

    is there any problem with "Q = quad(F,0.01,0.05)" command???
    Thank you for your help...
  2. jcsd
  3. Dec 13, 2004 #2
    Why do you think the real answer is 0.361?
    I see that
    F(0.05) - F(0.01) = 0.361
    but this is of course not the integral, the integral is smaller.

    The function is increasing and so on the interval [0.01, 0.05] it is maximum at 0.05, there it is 0.3834. Overestimating the integral by assuming that F would be 0.3834 everywhere in the interval [0.01, 0.05] would give an area: 0.3834 * 0.04 = 0.0153
    which is close to 0.0059 (the answer that quad gives).
    I think 0.0059 is the right answer.
  4. Dec 13, 2004 #3

    ok now 1ve got it , 1 made a big mistake but 1 am happy to know my command is true . Thank you again
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook