+ Post New Thread
Results 1 to 10 of 10
  1. #1
    Member level 1
    Points: 2,452, Level: 11
    Luckybuilding's Avatar
    Join Date
    Oct 2005
    Posts
    39
    Helped
    17 / 17
    Points
    2,452
    Level
    11

    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

  2. #2
    Newbie level 5
    Points: 1,456, Level: 8

    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.

    •   Alt19th August 2006, 23:26

      advertising

        
       

  3. #3
    Advanced Member level 4
    Points: 11,529, Level: 25
    safwatonline's Avatar
    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.

    •   Alt19th August 2006, 23:29

      advertising

        
       

  4. #4
    Full Member level 5
    Points: 3,308, Level: 13
    neils_arm_strong's Avatar
    Join Date
    Jan 2006
    Posts
    288
    Helped
    27 / 27
    Points
    3,308
    Level
    13

    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.

    •   Alt20th August 2006, 15:23

      advertising

        
       

  5. #5
    Advanced Member level 1
    Points: 4,907, Level: 16

    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.

  6. #6
    Advanced Member level 4
    Points: 11,529, Level: 25
    safwatonline's Avatar
    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



  7. #7
    BC
    BC is offline
    Newbie level 1
    Points: 1,434, Level: 8

    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.



  8. #8
    Member level 1
    Points: 2,452, Level: 11
    Luckybuilding's Avatar
    Join Date
    Oct 2005
    Posts
    39
    Helped
    17 / 17
    Points
    2,452
    Level
    11

    calculate area under curve matlab

    Thanks,

    I solved the problem with trapz(x,y)



  9. #9
    Full Member level 5
    Points: 2,850, Level: 12

    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



  10. #10
    Newbie level 1
    Points: 1,125, Level: 7

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



+ Post New Thread
Please login