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 for Programming
 LabTalk Forum
 interpolating
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

amorris

Canada
Posts

Posted - 10/04/2005 :  3:38:05 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7.5
Operating System: WinXP

Hi everyone,

I have some data that looks like this:

X | Y
--------
... | ...
1.5 | 3.16687
1.6 | 3.45679
1.7 | 4.01003
1.8 | 4.45293
1.9 | 5.03876
2.0 | 5.51181
... | ...

I would like to know if it is possible to write a little script that would guess which X goes with a Y value of 5 (say). My data doesn't always look the same so I can't just fit it and then solve for x when y=5. Does anyone know how to do this?

Thanks!

Alexis

amorris

Canada
Posts

Posted - 10/04/2005 :  3:56:55 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
As an alternative, I can interpolate with a large number of data points (say 5000) with the origin analysis->interpolate command. What I need then is a way of asking origin which data point in the InterExtrap worksheet has a y-value which is closest to what I'm looking for...
Go to Top of Page

rlewis

Canada
253 Posts

Posted - 10/04/2005 :  4:06:34 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
There is always the OriginC function ... Curve_yfromX ...
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 10/04/2005 :  4:39:37 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
There are several ways to interpolate in Origin. Here are a few others...

http://www.originlab.com/www/support/resultstech.aspx?language=English&ID=101

The Curve Spline Interpolate example at http://www.originlab.com/index.aspx?s=8&lm=243

http://www.originlab.com/forum/topic.asp?TOPIC_ID=844

http://www.originlab.com/forum/topic.asp?TOPIC_ID=4160

Mike Buess
Origin WebRing Member
Go to Top of Page

amorris

Canada
Posts

Posted - 10/04/2005 :  4:59:11 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks for the replies. Mike, I'll have to study those examples to help me get proficient with originC... As for the problem at hand, as you suggested rlewis, what I need is exactly provided by the OriginC function Curve_xfromY. The only problem is that I can't get it to work! I've tried compiling the example in the help file but it says that there is a variable declaration error. Here's the example from the help file:


double dXfromY;
Curve crvMyCurve( "Data1_A", "Data1_B" ); // Create Curve object
dXfromY = Curve_xfromY( &crvMyCurve, 0.25 ); // Get X value at Y=0.25
printf( "X from Y=0.25:\t%f\n", dXfromY );


Does anyone know what's wrong? I'm sorry to pester you all with these simple questions--I hope that I'm not too annoying.

Thanks,

Alexis
Go to Top of Page

rlewis

Canada
253 Posts

Posted - 10/04/2005 :  5:50:33 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Compile and link the the following ...


void getY(string strCurveY,double xVal)
{
Curve crvMyCurve(strCurveY);
if(crvMyCurve.IsValid()==true)
{
double dXfromY = Curve_yfromX( &crvMyCurve, xVal );
printf( "X = %f, Y = %f\n", xVal,dXfromY);
}
}



Open a graph window in which the dataset is plotted.
Make the dataset of interest the active dataset.
Issue the command GetY(%C,0.25)



Go to Top of Page

quickkk

Canada
23 Posts

Posted - 10/07/2005 :  3:56:35 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks rlewis, that was extremely helpful.

Cheers,

Alexis
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