MATLAB Understanding Integration in MATLAB: A Case Study

AI Thread Summary
The discussion revolves around the calculation of the integral of a function defined in MATLAB. The user initially expected the integral of the function F from 0.01 to 0.05 to yield a result of 0.361 but received 0.059 instead. After some analysis, it was clarified that the value 0.361 represents the difference F(0.05) - F(0.01), not the integral itself. The integral, being an area under the curve, is indeed smaller than this difference. The function is increasing over the specified interval, and the maximum value at 0.05 is 0.3834. The user concluded that the output of 0.059 from the quad command is correct, acknowledging a misunderstanding of the integral's nature.
furkang
Messages
9
Reaction score
0
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...
 
Physics news on Phys.org
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.
 
gerben said:
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:
 

Similar threads

Replies
2
Views
3K
Replies
4
Views
1K
Replies
7
Views
2K
Replies
3
Views
2K
Back
Top