T O P I C R E V I E W |
BIETZ |
Posted - 05/13/2011 : 05:34:26 AM 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 |
8 L A T E S T R E P L I E S (Newest First) |
couturier |
Posted - 09/05/2011 : 2:57:38 PM 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 |
couturier |
Posted - 09/05/2011 : 07:49:54 AM 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) |
Xeal |
Posted - 09/05/2011 : 02:51:33 AM 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 ?
|
BIETZ |
Posted - 05/20/2011 : 05:16:49 AM Thanks guys :-) |
couturier |
Posted - 05/17/2011 : 09:23:32 AM 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]; |
rlewis |
Posted - 05/17/2011 : 12:25:16 AM 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 ...
|
easwar |
Posted - 05/15/2011 : 11:26:55 AM 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 |
BIETZ |
Posted - 05/13/2011 : 05:41:26 AM 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 |