Calculate area under XY graph

Hello to all, I am plotting the data acquired from the system as amplitude v/s time on XY graph. My task is to calculate are under the graph and am using integrator tool to achieve this. However, feel that am not using correctly as answer is not matching with expected value. For example, I have plotted y=x function and as per the definition area is equal to 0.5*height*base for area under the graph. It is not matching, kindly help as I want to find out area under the curve for any two points of X-axis.
Attachments:
xy-graph.vi ‏22 KB

The integration gets accurate in your case if you change the integration method to 'trapezoidal' instead of the default 'Simpson's Rule'.
Simpson's Rule probably doesnt work because you don't provide suitable Initial and Final conditions. This method needs an assumption about the borders of the integration interval.
Cheers
Edgar

Similar Messages

  • Calculate area under the graph

    Hi
    I need to calculate area under the graph, but really have no idea.
    Anyone could give me some idea please.
    Merci.
    Solved!
    Go to Solution.
    Attachments:
    Graph PV.JPG ‏35 KB

    I don't know whether the example CC attached in this thread will help you or not. Please go through it.
    Start your own program. Whenever you stuck up at any point, post here. Genius people around the forum here will surely guide you to proceed further. don't worry.
    Enjoy wiring.
    Mathan
    Message Edited by mathan on 03-16-2009 05:33 AM

  • Integral of waveform graph to calculate area under curve over time

    Hello ,
    Please find my attached VI and please help me for integration to get area undercut for my waveform graph.
    I would like to find total  Energy output from my wind power  waveform graph oever one month period of time.
    I believe i have to integrate to get area under curve and so i m now using integral tool in labview as attached. 
    As I don't have expected ans for my result and so i want to make sure the tool that i m using is correct.
    Please advise me which method of integration shall i use for my graph.
    Solved!
    Go to Solution.
    Attachments:
    Wind data only.vi ‏134 KB
    wind data.txt ‏1253 KB

    I don't know about your calculations to get the Wattage.  But as far as integration, you really should supply a dt (sample rate) in order to get a proper energy measurement.  I would use your second integration method (the one with "Result" as the indicator) and give it the dt as well.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How can I calculate area under a curve?

    I would like to use an integral equation to obtain positive and negative areas from graphed data. For example, I have a graph representing power for a 24 hour period and want to integrate the curve to obtain daily energy.

    One common way to approximate the area under a curve is to divide it into a series of trapezoids, with the area of each calculated as avg height x width. Then sum the areas.
    So with this table:
    x     

    trapezoid
    1
    0
    3
    2
    6
    11
    3
    16
    23
    4
    30
    39
    5
    48
    59
    6
    70
    83
    7
    96
    218
    You could use this formula in C2, filled down through the rest of the body cells in that column:
    =IFERROR((B3+B2)÷2×(A3−A2),"")
    This calculates the area of each trapezoid.
    The first row is defined as a Header Row, the last row as a Footer Row.  It's important not to have blank row(s) before the Footer Row. The sum formula in the Footer Row in C9 is:
    =SUM(C)
    Of course, the greater the number of x-y data points the better the estimate of the area under the curve.
    SG

  • How to calculate area under the waveform

    I need to calculate absolute energy of the waveform. Do you have a math function to do this? I used Integrate funtion but the return value is 0.

    You didn't say much about what you are doing. The CNiMath::Integrate function should be able to do this for you. Maybe you don't understand the function. You would input your waveform as a vector (say 1000 elements), then the delta time between each element (1/sampling rate), then the first and last value of the discrete integral (waveform[-1] and waveform[n]). Then, on output, the vector would contain the integrated data. You could get the sum of the elements to get the total area under the curve.
    Best Regards,
    Chris Matthews
    National Instruments

  • How do I calculate areas under the curves above and below the x axis at 0?

    The xy graph generated is similar to a sinusoidal representing the magnetic intensity of the poles of a motor. For each of the four areas above and below the x axis at 0 I would like to calculate the area then do a variance analysis on the 8 areas. Can anyone suggest a method to calculate each of the 8 areas. See the attached vi to understand better what I'm trying to do.
    Thank you.
    Attachments:
    MIN MAX A.vi ‏16 KB

    Hi all,
    If you are simply looking to do numeric integration, there is built in functionality to do that.  The help file is here:
    http://zone.ni.com/reference/en-XX/help/371361H-01/gmath/numeric_integration/
    You will may have to do some edge checking if you want to break this down into individual components.
    Let us know if you need any more assistance
    Applications Engineer
    National Instruments

  • Regression area under the curve

    hello
    i was trying to get the area under the curve. mathematically the
    integration can b done directly from 'numeric integration' vi. but what
    my problem is i cant define the time t1 to t3( as i need to set the
    threshold level to eliminate noise). what i previously did was defining
    the threshold level, find the 2 point of t1 and t2. but i left out the
    coloured portion. using regression will it help to get t3?if yes. how
    this will b done?
    thanks
    regards
    Attachments:
    graph(dt)1.PNG ‏8 KB

    This has been going on for a while:
    http://forums.ni.com/ni/board/message?board.id=170&message.id=226483#M226483
    http://forums.ni.com/ni/board/message?board.id=MathScript&message.id=145#M145
    http://forums.ni.com/ni/board/message?board.id=170&message.id=227008#M227008
    If I understand this correctly, you use a threshold to find the peak, but then you want the entire area, including the "wings".
    As I said before, if you pick the baseline right, your integration boundary does not need to be exact and can be significantly outside because the areas outside the peak will average to zero.
    If you have a mathematical model for the peak (e.g. gaussian), you can fit it and calculate the area from the fit.
    LabVIEW Champion . Do more with less code and in less time .

  • Calculating area under a curve - trapezium rule

    Hi,
    I'm trying to calculate the 'area under the curve' using the trapezium rule for a set of data points. i.e. I have a set of values, sampled at irregular intervals.
    create table measurements (
      measurement_value integer,
      measurement_time timestamp
    insert into measurements (measurement_value,measurement_time) values (50,TIMESTAMP'2011-01-01 00:00:00');
    insert into measurements (measurement_value,measurement_time) values (40,TIMESTAMP'2011-01-01 01:00:00');
    insert into measurements (measurement_value,measurement_time) values (40,TIMESTAMP'2011-01-01 03:00:00');
    insert into measurements (measurement_value,measurement_time) values (50,TIMESTAMP'2011-01-01 03:30:00');
    insert into measurements (measurement_value,measurement_time) values (40,TIMESTAMP'2011-01-01 05:00:00');
    insert into measurements (measurement_value,measurement_time) values (40,TIMESTAMP'2011-01-01 06:00:00');
    insert into measurements (measurement_value,measurement_time) values (60,TIMESTAMP'2011-01-01 07:00:00');I'd like to calculate the area of the 'curve' where the value was below a threshold of, e.g. 45.
    I can use the trapezium rule and assume a straight line between subsequent measurement, i.e. for the first 2 data points, the value drops from 50 to 40 linearly over the hour, and so the area for those measurements is (30min * 5)/2. For the 2nd and 3rd data points, the area is (120min * 5), for the 3rd and 4th, the area is (15min * 5)/2. And so on. The values are not necessarily round numbers, almost any value is possible.
    I've started by using 'lead' to obtain the subsequent measurement value and time, but I'm getting stuck dealing with the end points and non-trivial interpolation. Does anyone have any pointers to get me going?
    Thanks,
    Dan Scott

    Maybe this will do it:
    SELECT SUM(CASE
                WHEN curr_value > :threshold AND next_value < :threshold
                THEN -- Area of rectangle specified by threshold
                     (new_measurement_time_sec-curr_measurement_time_sec)*:threshold
                   + -- Area of remaining trapezoid
                     ABS((next_measurement_time_sec - new_measurement_time_sec)*((next_value - :threshold)/2))
                WHEN next_value > :threshold AND curr_value < :threshold
                THEN -- Area of rectangle specified by threshold
                     (next_measurement_time_sec-new_measurement_time_sec)*:threshold
                   + -- Area of remaining trapezoid
                     (new_measurement_time_sec - curr_measurement_time_sec)*((:threshold - curr_value)/2)
                WHEN (:threshold < curr_value AND :threshold < next_value)
                  OR (:threshold > curr_value AND :threshold > next_value)
                THEN (next_measurement_time_sec-curr_measurement_time_sec)*:threshold
                ELSE -- Area of trapezoid
                     ABS((next_measurement_time_sec - curr_measurement_time_sec)*((next_value - curr_value)/2))
           END)  AS area
    FROM   (
             SELECT measurement_time
                  , curr_measurement_time_sec
                  , next_measurement_time_sec
                  , curr_value
                  , next_value
                  , (:threshold - LEAD(intercept) OVER (ORDER BY measurement_time))/LEAD(slope) OVER (ORDER BY measurement_time) AS new_measurement_time_sec
             FROM   ( SELECT measurement_time        
                           , TO_CHAR(measurement_time,'J')*24*60*60 + TO_CHAR(measurement_time,'SSSSS') AS curr_measurement_time_sec
                           , TO_CHAR(LEAD(measurement_time) OVER (ORDER BY measurement_time),'J')*24*60*60 + TO_CHAR(LEAD(measurement_time) OVER (ORDER BY measurement_time),'SSSSS') AS next_measurement_time_sec
                           , measurement_value                                        AS curr_value
                           , LEAD(measurement_value) OVER (ORDER BY measurement_time) AS next_value
                           , REGR_SLOPE(measurement_value, TO_CHAR(measurement_time,'J')*24*60*60 + TO_CHAR(measurement_time,'SSSSS')) OVER (ORDER BY measurement_time) AS slope
                           , REGR_INTERCEPT(measurement_value, TO_CHAR(measurement_time,'J')*24*60*60 + TO_CHAR(measurement_time,'SSSSS')) OVER (ORDER BY measurement_time) AS intercept
                      FROM   measurements
           )Results:
    SQL> var threshold NUMBER;
    SQL> exec :threshold := 45;
    SQL> /
          AREA
    1191437.2The units are the time values were converted to seconds since January 1, 4712 BC (roughly).
    Edited by: Centinul on Jul 7, 2011 10:39 AM

  • Measuring the area under a torque waveform produced by a rotating shaft.

    I am measuring a torque waveform that a shaft produces as it spins up to speed. I am using the waveform vi's in Labview to calculate the total time of the waveform. Is there an easy way to calculate the area under the waveform? The hope is that we wil be able to figure out the amount of work done.

    Here is a VI that should do the trick. It is a basic integral of your waveform.
    Christian L
    NI Consulting Services
    Christian Loew, CLA
    Principal Systems Engineer, National Instruments
    Please tip your answer providers with kudos.
    Any attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system,
    or for use in hazardous environments. You assume all risks for use of the Code and use of the Code is subject
    to the Sample Code License Terms which can be found at: http://ni.com/samplecodelicense
    Attachments:
    waveformpicture.vi ‏80 KB

  • Regarding Area Under Curve of ROC-ODM

    Which method is used by Oracle Data Miner to calculate the Area Under Curve(AUC) of ROC? either trapezoidal or other ? Please reply me

    Using the trapezoid method, the numerical integration is rather direct.
    See the attached vi.
    You can't get the function described by the X and Y arrays. You need to know the function from start ! However, you can always fit a function to the data. Polynomial curve fitting is quite popular. Of course this is something you could have done : fit a polynomial, then integrate it. With a large number of points (such as yours), the result will not be better than the trapezoid method.
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        
    Attachments:
    Area.vi ‏30 KB

  • Area under Curve -- ROC-- Classification

    Dear All,
    I had applied classification technique and plot the ROC curve, the Oracle Data miner calculates the Area under Curve of that ROC, anyone please tell me on which formula does the Area under curve is calculated....

    which formula is used to calculate the area under ROC curve in oracle data miner

  • Area under curve

    i am having the hardest time calculating area under a closed curve using basic maths. I have tried the integrate function (by splitting the curve in two and then adding the two). I am not susre of the answer so i am using basic math functions to code the thing in. So far i have:
    L1 = globusedchn
    CALL FORMULACALC("CH(L1):=CH('D')*CH('F')")
    CC(L1)="MULTIPLIED POINTS"
    CN(L1)="MULTPTS"
    R4 = 0
    R1 = CHDX(1, L1)
    R2 = CHDX(2, L1)
    R3 = R2 - R1
    R4 = R3 + R1
    A = R4
    FOR I = 2 TO CL(L1)
    L2 = I
    R5 = CHDX(L2, L1)
    R6 = CHDX(L2+1, L1)
    R7 = R6 - R5
    R8 = R7 + A
    A = R8
    NEXT
    CALL MSGBOXDISP(R8 & " = new area")
    maybe its my data but i keep getting R8 as 0. Any pointers will be greatly appreciated. Thanks ~sn

    Hi shefalika,
    It looks to me like the ChnIntegrate() function is the one to use. Note that the entire area under the curve is just the last value of the integrated curve. I included your original data in the ZIP file attached below, along with a quick VBScript which loads the data, creates 2 new channels which are the integral of channels 2 and 3 vs. channel 1, respectively, and loads a REPORT layout to show the results.
    The REPORT layout shows the raw data curves twice, once as a thick red line and then again as vertical blue spikes. This gives you the visual respresentation of the area under each curve being blue. I then included on each of the 2 graphs a text box which displays the last value of the integrated channel for that raw data curve. This is not a static value but an embedded @ function in the REPORT layout, specifically:
    Area Under Curve = @str(ChDX(CL('Area1'), 'Area1'), 'd')@
    for the 1st graph. Note that the area under the curve value is pulled explicitly from the channel named "Area1", so if you rename the integrated channel, you will need to change the channel reference in each of these 2 embedded @ formulas in the REPORT layout. The str() function formats the string result to not show any decimal points in the results (you could use 'd.ddd" instead, for instance). The ChDX(row, channel) function returns the value from the "row-th" data row of the "channel" data channel.
    Also note that several items in this example are built with DIAdem 9.1 features. If you need an earlier version of the example, let me know and I can build it again in DIAdem 8.1.
    Ask if you have further questions,
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments
    Attachments:
    Area Under Curve.zip ‏12 KB

  • Area under normal curve

    I need to calculate the area under a normal (gaussian) curve between two given limits. Is there some algorithm or freely usable library which I could use to calculate this? I've searched around but so far have come up with nothing.

    , i.e., something relatively close to
    the precision of 'double'. Why do you need it to be so precise? After all, when you're dealing with statistics there's always a level of probability. Even if you had double precision, would that make the final result more accurate?
    I expect there's
    probably some asymptotic approach that approaches the
    desired precision in some fixed number of
    iterations.
    Probably so. Just out of curiosity I wanted to measure the change in area as the number of points grew by a factor of 10. here are the results:
    0.9746011459589066 numPoints: 80
    0.9803552459545505 numPoints: 800 area - oldArea: 0.005754099995643913
    0.9808610053578404 numPoints: 8000 area - oldArea: 5.05759403289896E-4
    0.9809109343345651 numPoints: 80000 area - oldArea: 4.992897672473351E-5
    0.9809159208101573 numPoints: 800000 area - oldArea: 4.986475592216877E-6
    0.9809164193936031 numPoints: 8000000 area - oldArea: 4.985834457515992E-7
    0.980916469248969 numPoints: 80000000 area - oldArea: 4.985536594670492E-8
    Basically, if you use 10 times as many points from one to the next, you get an extra decimal place of accuracy. So if you can live with 4 decimal places of accuracy, then maybe this method is ok, otherwise the computation becomes expensive.
    Here is the code:
    public class ATest {
         public static void main(String[] args) {
         double oldArea = -1;
         for (int k = 0; k < 6; k++) {
              double dx = 0.1 / Math.pow(10, k);
              double x1 = -4.0;
              double x2 = 4.0;
              int numPoints = (int) Math.round((x2 - x1) / dx);
              double area = 0;
              for (int i = 0; i < numPoints; i++) {
                   int j = (i + 1) % numPoints;
                   double xi = x1 + i * dx;
                   double xj = x1 + j * dx;
                   double yi = calcFunction(xi);
                   double yj = calcFunction(xj);
                   area += xi * yj - xj * yi;
              if (area < 0) area = -area;
              area = area / 2;
              if (oldArea != -1) {
                   double dif = area - oldArea;
                   System.out.println(area + " numPoints: " + numPoints + " area - oldArea: " + dif);
              else
                   System.out.println(area + " numPoints: " + numPoints);
              oldArea = area;
         private static double calcFunction(double X) {
              double SIGMA = 1.0;
              double SIGMA_SQ_2 = SIGMA * SIGMA * 2;
              double C = 1.0 / Math.sqrt(Math.PI * SIGMA_SQ_2);
              double MU = 1.0;
              double xmu = X - MU;
              return C * Math.exp(-1 * xmu * xmu / SIGMA_SQ_2);
    }

  • What is a quick alternative to launching an enterprise DPS app if Apple Store rejects the App? We are under a major deadline and can't wait for Apple. We want to host the app elsewhere. How do we host our DPS app on our client's website?

    What is a quick alternative to launching an enterprise DPS app if Apple Store rejects the App? We are under a major deadline and can't wait for Apple to approve. We want to host the app elsewhere. How do we host our DPS app on our client's website? Thanks.

    Unless I misunderstand the question, you can't do what you're asking to do. Apple doesn't allow you to bypass their store and host public apps on a website. The exception is an enterprise app, which requires an Enterprise account with both Apple and Adobe. This type of enterprise app can be distributed only within the company. If that's what you want to do, you can learn more here:
    Digital Publishing Suite Help | Creating viewer apps for private distribution
    Distributing enterprise iOS viewer applications with Digital Publishing Suite | Adobe Developer Connection
    Another option is to add the development app to several devices and use those for your demo.

  • Is there any way that I can share an in-app purchase over multiple devices even if they are under the same iTunes account?

    So there are several iOS devices in my family and on one of our iPads we have purchased an in-app purchase. I also have the same app on another iPad and would like to also have access to that in-app purchase. Both of these devices are under the same iTunes account so is there a way to share this in-app purchase across multiple devices?

    You can check here  >  iTunes Store: About In-App Purchases
    But I don't think this is possible.

Maybe you are looking for

  • How to assign version in sales order and transfer to PP module

    Hi all Users say that customer will require to produce/deliver old goods (we active revision level. The newest material version is D. But customer want version B). How to assign version in sales order and let PP user know the version customer want (M

  • HTTP Adapter Issue - ATTRIBUTE_CLIENT_DEST

    Hello Everyone, Just curiou to know if anyone has seen this type of issue before from SXMB_MONI:   <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> - <!--  Call Adapter   --> - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP

  • HT4437 mirroring the computer on apple tv

    Is there a way to mirror what is on my MacBook Pro onto the tv using Apple TV?

  • LinkSys Wireless Card connects to "Access Point" but no internet connection

    I have 2 LinkSys wireless cards. one is 802.11g, the other b. The signal for the Airport Extreme 802.11n Wi-Fi Wireless Base Station is very strong, but when I try to connect, it says "You are connected to the access point, but the Internet cannot be

  • OO Design for Property type

    We are currently in the design process for an application that will use an ORM and are trying to create an object model that will make the most sense for using the ORM to save data to the database. At this time, we will not be using the ORM to instan