MATLAB Computing the area under a curve with Matlab

AI Thread Summary
To find the area under the curve in MATLAB, the command used is quad(f(x), a, b), which evaluates the integral from a to b of the function f(x). There is some confusion regarding the commands "quad" and "quad1," with clarification needed on whether f(x) represents y = f(x). For plotting data values from Excel in MATLAB, users can either approximate the curve with a polynomial and evaluate the integral or use the formula that sums the product of function values and the differences in x values, though these methods yield approximate solutions. For an exact solution, the function f(x) must be known.
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
<br /> \int_a^b f(x) dx<br />
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):
\sum_{i=1}^{n-1} f_i(x_{i+1}-x_i) , where f_i=f(x_i)

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)
 

Similar threads

Back
Top