- 19th August 2006, 22:20 #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)

please, guide me.

Thanks

- 19th August 2006, 22:20

- 19th August 2006, 23:26 #2

- Join Date
- Mar 2006
- Posts
- 10
- Helped
- 3 / 3
- Points
- 1,456
- Level
- 8

## 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.

- 19th August 2006, 23:29 #3

- Join Date
- Nov 2005
- Location
- EGYPT
- Posts
- 1,347
- Helped
- 211 / 211
- Points
- 11,529
- Level
- 25

## 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.

- 19th August 2006, 23:29

- 20th August 2006, 15:23 #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.

- 20th August 2006, 15:23

- 20th August 2006, 16:19 #5

- Join Date
- Jul 2005
- Posts
- 452
- Helped
- 78 / 78
- Points
- 4,907
- Level
- 16

## 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.

- 20th August 2006, 17:11 #6

- Join Date
- Nov 2005
- Location
- EGYPT
- Posts
- 1,347
- Helped
- 211 / 211
- Points
- 11,529
- Level
- 25

## 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

- 20th August 2006, 20:33 #7

- Join Date
- Jan 2005
- Posts
- 1
- Helped
- 0 / 0
- Points
- 1,434
- Level
- 8

## 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.

- 22nd August 2006, 15:28 #8
## calculate area under curve matlab

Thanks,

I solved the problem with trapz(x,y)

- 25th August 2006, 21:51 #9

- Join Date
- Oct 2005
- Location
- South Africa
- Posts
- 296
- Helped
- 27 / 27
- Points
- 2,850
- Level
- 12

## 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

- 5th September 2006, 21:22 #10

- Join Date
- Sep 2006
- Posts
- 1
- Helped
- 0 / 0
- Points
- 1,125
- Level
- 7

## 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))**