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
 X values for which Y close to a target value
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

flombone

Italy
3 Posts

Posted - 04/24/2013 :  09:40:32 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release: 8 SR5
Operating System: Windows XP Professional

Hello everybody,

I am trying to write a LabTalk script able to calculate few critical parameters of a large set of data. These represent a lot of S-shaped curves that span from ymin to ymax. I am having problems to calculate the x value for which y gets closer to the mean value (ymax+ymin)/2.
Do you have any idea about how to calculate it?

Thanks in advance!

JacquelineHe

287 Posts

Posted - 05/03/2013 :  06:28:52 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,
I assume that the X and Y values are in the column 1 and 2. You can try to use this script to get the value:

wks.addcol();// add a new column
double bb=max(col(2)); 
double cc=min(col(2));

int aa = wks.ncols;
wcol(aa)=abs(col(2)-((bb+cc)/2));

limit wcol(aa); // Find min value in the new column using limit command
double dd = col(1)[$(limit.imin)]; // limit.imin -- Corresponding index for minimum Y value. 

dd=;

Please refer to this page about the limit command.
http://www.originlab.com/www/helponline/Origin/en/Programming/mergedProjects/LabTalk/LabTalk/Limit_%28command%29.html

Thanks,

Jacqueline
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