# Computing the area under a curve with Matlab

1. Jan 17, 2009

### Faiza Mustafa

how to find the area under the curve by using matlab
i mean to say what is the command for this

2. Jan 17, 2009

### Faiza Mustafa

Re: difficult integral.....

i am worried

Thanks

3. Jan 17, 2009

### qntty

The command to evaluate
$\int_a^b f(x) dx$
is

Code (Text):

4. Jan 18, 2009

### Faiza Mustafa

Thanks alot

I shall check it.

5. Jan 18, 2009

### Faiza Mustafa

Hi qntty

hw r u?

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

6. Jan 18, 2009

### ialbrekht

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)