# How to compute area under a curve using Matlab???

1. ## matlab area under curve

Hi, all
This may make you laughing. But, I don't know how to compute area under a curve using Matlab having only (x,y) values of the curve?

(Not having the function of equation)

Thanks

•

2. ## area under curve matlab

This is just a shot in the dark, but if you can find the equation from the points then you simply need to integrate right?

This site explains how to use the curve fitting tool.

http://www.jcmiras.net/jcm/item/87/

I've never done this before, but I hope this helps

1 members found this post helpful.

3. ## area under the curve matlab

hi,
if u have x,y values then u should integrate let y=f(x)

where z=area under curve=integration of y with respect to x=int[x0,xf] of (f(x))dx how to integrate u take a slice of f(x) and move it along x-axis which in ur case is simply the smallest step between to values of the x,y values so u just add the y values but u have to have very small step between two successive points in order to apprximate each point as a slice.

1 members found this post helpful.

•

4. ## area under curve in matlab

Since (x,y) values are availabel ,use any of the numerical techniques like simpsons method or trapezoidal rule etc. for integration.

1 members found this post helpful.

•

5. ## matlab area under a curve

If you want a rough aproximation simpsons, newton
or trapeziodal should be enough. If you want
aproximation by curves using Lagrange Polynomials
or Spline should also be enough.
see: Chapra/Canale, Numerical Methods for Engineers
or Al-Khafaji/Tooley. Numerical method for engieers
or Shiavi,R. Applied Statistical Signal Analysis

1 members found this post helpful.

6. ## area under the curve in matlab

Hi,
i have a question about the numerical methodes used , isnt those justan apprxiamation, and if we have the values of x,y at all points we can just add the y values,
thnx

7. ## area under a curve matlab

Yes, all the numerical methods are just approximations of an actual function.

Really if you just added up all the y values this would just be an approximation as well as you will not actually know all the values of the function at all times.

ie let's say you have a function f(x) and you know f(5),f(5.1),f(5.2). Since you don't actually know f(5.11), f(5.111), f(5.1111) etc if you simply add up all the y values it will still be an approximation. As your step size (step size=0.1 for using 5,5.1,5.2...) decreases the error of your approximation decreases as well. Once your step size approaches 0, you get the integral of the function.

The point of the numerical methods is to reduce the error between your approximation and the integral of the real function.

8. ## calculate area under curve matlab

Thanks,

I solved the problem with trapz(x,y)

1 members found this post helpful.

9. ## area under graph matlab

Numerical methods are just an approximation but some of the methods provide very accurate results. Spaceflight is computed numerically and I don't think that is poor math. Also some problems are extremely hard to solve symbolically, and besides if you are going to implement the result on a MCU / PC / etc then it is pintless to have endless accuracy as it doen's exist in PCs (finite wordlength problem)

Cheers
Slayer

•

10. ## matlab area under the curve

I just wanted to know if the following gives the AUC for given values x,y

integral = ppval(fnint(csape(x,y)),max(x))

--[[ ]]--