The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 equal areas under curve
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

BIETZ

Germany
3 Posts

Posted - 05/13/2011 :  05:34:26 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hey guys,

I try the following and got stuck:

I want to find the x-value that divides the graph so that the grey areas are equal.




Is this possible with Origin in any way?

Thanks a million in advance!
Chris

BIETZ

Germany
3 Posts

Posted - 05/13/2011 :  05:41:26 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
P.S.: The integral would be:

\intgral from c^L to c^R (x-x_M) dc = 0

where x_M is the point I'm looking for...

Cheers
Go to Top of Page

easwar

USA
1964 Posts

Posted - 05/15/2011 :  11:26:55 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Chris,

Currently there is no specific tool to find this x-value. But in version 8.5/8.5.1, we have an Integration gadget:
http://originlab.com/index.aspx?go=Products/Origin/DataAnalysis/Gadgets/Integration

In this gadget you can set baseline to any arbitrary constant, and the curve is then integrated with respect to that baseline, within the limits of the ROI (even if ROI edges are set to be in between data points).

You could try that gadget. Note that two instances of the gadget can be placed on the graph at the same time, and one could be used to find left area, and then other to find right area, with the baseline set to min and max y values respectively. Then you could move/resize the roi's to find the x value that gives equal area.

Easwar
OriginLab
Go to Top of Page

rlewis

Canada
253 Posts

Posted - 05/17/2011 :  12:25:16 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
For a function f(x) of the type shown, the x-value required can be calculated with an equation of the type below once the area under the curve is determined ...



Go to Top of Page

couturier

France
291 Posts

Posted - 05/17/2011 :  09:23:32 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The value you're searching for is the median value.
You can easily find it with the following:

Range Xdata=1, Ydata=2; // assuming X is in col(1) and Y in col(2);
diststats iy:=(Xdata, Ydata);
diststats.median=;

If you want to get the value for a particular interval, you can more precisely decalre your range, like:
Range Xdata=1[indexbegin:indexend], Ydata=2[indexbegin:indexend];
Go to Top of Page

BIETZ

Germany
3 Posts

Posted - 05/20/2011 :  05:16:49 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks guys :-)
Go to Top of Page

Xeal

10 Posts

Posted - 09/05/2011 :  02:51:33 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by couturier

The value you're searching for is the median value.
You can easily find it with the following:

Range Xdata=1, Ydata=2; // assuming X is in col(1) and Y in col(2);
diststats iy:=(Xdata, Ydata);
diststats.median=;

If you want to get the value for a particular interval, you can more precisely decalre your range, like:
Range Xdata=1[indexbegin:indexend], Ydata=2[indexbegin:indexend];



This is only possible in origin 8, becaus of the use of xfunctions.
Is there an other way to do this in Origin 7.5 ?

Go to Top of Page

couturier

France
291 Posts

Posted - 09/05/2011 :  07:49:54 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Okay,

you can try the following, assuming your XY data are in worksheet Data1 in cols A and B.
Add 1 col C

integ Data1_B; // integrate column B and store result in _integ_area
sum(_integ_area); // compute some values on integral
_integ_area/=sum.max; // divide integral by maximum value. The value you're searching for occurs when integral=0.5
Data1_C=treplace(_integ_area,0.5,0,3); //Data1_C is set to 0 when integral<0.5
Data1_C=treplace(Data1_C,0.5,0.5,4); //Data1_C is set to 0.5 when integral>=0.5
median=list(0.5,data1_C); //get index number of searched value and put it into variable median
median=Data1_C[median]; // put into variable median corresponding x Value
del Data1_C; // delete column
median=; // print result in script window

This should work (and run much faster than Xfunction)
Go to Top of Page

couturier

France
291 Posts

Posted - 09/05/2011 :  2:57:38 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
i've made a typo. At the end of the script, you should read:

median=Data1_A[median]; // put into variable median corresponding x Value
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000