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
 claculation of overlap area under two curves
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

oyais

India
7 Posts

Posted - 08/05/2013 :  03:35:18 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
PLease let me know how to calculate overlap or common area under two curves using origin 8.5

oyais

Shirley_GZ

China
Posts

Posted - 08/05/2013 :  05:48:38 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Oyais,

The Integrate gadget can be used here.

First, use this gadget to calculate the area under each curve, area1 and area2(without baseline by default, integrate from the straight line y=0). Then go to the Preferences dialog, set the baseline as one of the curves to calculate the absolute area between these two curves, area3.

overlapping area = (area1 + area2- area3)/2

Area1:


Area2:


Area3:


Shirley

Originlab Technical Service Team

Edited by - Shirley_GZ on 08/05/2013 05:53:13 AM
Go to Top of Page

oyais

India
7 Posts

Posted - 08/06/2013 :  03:01:12 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Sir i need to calculate the common area or overlap area(highlighted area as in fig.) under two curves as shown in the fig attached . I also have similar graphs but i have unable to calculate common area please guide.

oyais
Go to Top of Page

rlewis

Canada
253 Posts

Posted - 08/06/2013 :  6:29:19 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
If you are willing to do a little OriginC progamming the following OC function should do ...

double GetCommonArea(Curve CurveA, Curve CurveB)
{
	Dataset dsX, dsY;
	vector<double> xCurveA, yCurveA, xCurveB, yCurveB;
	if(CurveA.CopyData(xCurveA, yCurveA) == true && CurveB.CopyData(xCurveB, yCurveB)==true)
	{
		if(dsX.Create(xCurveA.GetSize()) == true && dsY.Create(xCurveA.GetSize())==true)
		{
			for(int i=0; i<xCurveA.GetSize(); i++)
			{
				dsX[i]=xCurveA[i];
				double yVal=(Curve_yfromX(&CurveB,xCurveA[i]));
				dsY[i]=min(yCurveA[i],yVal);
			}
			Curve CommonArea(dsX,dsY);
			if(CommonArea.IsValid()==true)
			{
				return (area(CommonArea));
			}
		}
	}
	return NANUM;
}

Go to Top of Page

oyais

India
7 Posts

Posted - 08/08/2013 :  12:51:13 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
is it necessary to do programming if yes pls lemme know how to use origin c programming to input this function

oyais
Go to Top of Page

greg

USA
1378 Posts

Posted - 08/08/2013 :  12:05:10 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
If your data shares the same X column, then the solution is simple:

Add a column to your worksheet.
Select the column and press Ctrl+Q (opens Set Values dialog).
Enter this expression, using your two Y column numbers or names:
min(col(B),col(C))
Click OK, then integrate that column to get the area.

If your data does not share the same X column, then you first need to create a common X column then use Analysis : Mathematics : Interpolate/Extrapolate Y form X to create new Ys and do the above with this data.
Go to Top of Page

oyais

India
7 Posts

Posted - 08/08/2013 :  10:41:44 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
@rlewis, programme showed errors.. i couldnt do it
@ Greg. I am sorry Greg could get u..
Kindly explain your procedure with an example and yes my dta doesnot have common x.If you wish i can forward the origin file to u via email.
Thanks!!

oyais
Go to Top of Page

rlewis

Canada
253 Posts

Posted - 08/09/2013 :  01:13:07 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I've tested the function and could find no error ...
What is/are the nature of the error/errors that you found ??
Go to Top of Page

oyais

India
7 Posts

Posted - 08/10/2013 :  06:16:26 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
i have forwarded data on the given mail
@rlewis pls help with programming... i am not able to do it

oyais
Go to Top of Page

oyais

India
7 Posts

Posted - 08/12/2013 :  02:45:50 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
@Christyli,
have u checked my data and pls update me about the calculation of common area under the two curves.

oyais

oyais
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 08/23/2013 :  4:35:42 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Here is what Greg has meant.

Col(E) is the Set Column Values' result of interpolated Y values based on the X dataset of the
second curve in Col(C). Its formula, "col(Y1)(col(X2))"uses a dataset(col(Y1)) as a function,
taking col(X2) as the argument.
(Note: You can make and use a separate X column with a range of your choice before this col(E).)
Also, see http://wiki.originlab.com/~originla/ltwiki/index.php?title=Script:Interpolation .

Col(F) is the Set Column Values' result of taking the lower values of col(D) vs. col(E) using min( ) function.

col(G) is the Integration result from col(F) (vs. col(C) as X).
Graph1 shows plots of col(B), col(D) and col(G). Col(G) plot has "Fill Area Under Curve" option.



Hope this has explained well.

--Hideo Fujii
OriginLab

Edited by - Hideo Fujii on 08/23/2013 5:22:03 PM
Go to Top of Page

misz_waza

Australia
1 Posts

Posted - 11/06/2014 :  5:25:56 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Hideo and Originlab tech support,
I can't really get it the step that you did to find the area under the curve.Can you explain step by step?Attach is the graph that I want to find the area?I want to find the area for the black colour..
Hope you can help me.

Thanks a lot
waza
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 11/07/2014 :  4:32:00 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi misz_waza,
1) Arrange your data as in the worksheet columns A, B, C, and D in my sample. 
2) Add three extra empty columns - E, F, and G.
3) Using Set Column Values tool, calculate the column E with the formula.
   Similarly, fill the column F. 
  http://www.originlab.com/doc/Origin-Help/Wks-SetColVal-QuickStart
4) Calculate the column G by integrate from the column F.
  http://www.originlab.com/doc/Origin-Help/Math-Integrate
Hope this helps.

--Hideo Fujii
OriginLab
Go to Top of Page

lkb0221

China
497 Posts

Posted - 05/21/2015 :  5:03:55 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi, everyone

There is a blog posted for this topic.
http://blog.originlab.com/graphing/fill-area-under-intersection-of-two-curves

Zheng
OriginLab
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