Computing the area under a curve with Matlab

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
5 replies · 13K views
Faiza Mustafa
Messages
4
Reaction score
0
how to find the area under the curve by using MATLAB
i mean to say what is the command for this
 
Physics news on Phys.org


please if anybody know about it then please reply me soon
i am worried

Thanks
 
The command to evaluate
[itex] \int_a^b f(x) dx[/itex]
is

Code:
quad(f(x),a,b)
 
Thanks a lot

I shall check it.
 
Hi qntty

hw r u?

thnx for the reply about my problem
in the previous problem i am actually confused between "quad" and "quad1" command
and is the f(x) is y=f(x)? i mean to say the function that relate the y and x.

Do you if there is some data values in excel then how
can we plot these values in matlab.

thnx
 
Hi Faiza,

If you have only few point of your curve, than you may use two ways:
1. Find approximation polynomial and than evaluate integral;
2. Just use following formula (by integral definition):
[tex]\sum_{i=1}^{n-1} f_i(x_{i+1}-x_i) , where f_i=f(x_i)[/tex]

There are some other methods you may find in the Internet.

Note: Both methods gives not exact solutions. For exact solution you have to know f(x)