View Full Version : Using Matlab for integration
furkang
Dec12-04, 04:59 PM
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...
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.
furkang
Dec13-04, 02:03 PM
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.
ok now 1ve got it , 1 made a big mistake but 1 am happy to know my command is true . Thank you again
:smile:
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.