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
 Call Find X/Y from LabTalk script
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

J.S.Schulte

Germany
11 Posts

Posted - 06/12/2024 :  02:29:57 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Pro 2024b and SR0
Operating System: Windows 10

Hello, I have written a LabTalk script in which I perform a curve fit with 2 exponents (expdec2) on imported data via nlfit. Everything works fine so far. However, I would like to subsequently calculate certain x-values using known y-values with the fitted curve. If you call up the nlfit function via the menu function, you can activate the Find X/Y function as an option, enter the corresponding y-values in the generated spreadsheet and read out the y-values. How can I activate/call the Find X/Y function within a LabTalk script?

Translated with DeepL.com (free version)

NicholasSupport

USA
89 Posts

Posted - 06/12/2024 :  11:43:38 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

I believe you are looking for the interp1 function: https://www.originlab.com/doc/X-Function/ref/interp1

https://www.originlab.com/doc/en/Origin-Help/FitRef-FindVal-StandardCurve

The script works for interpolating both X from Y and Y from X values. Just swap your Y values and X values. The code may look something like this:
interp1 -r 2 ix:=[Book1]Sheet1!D iy:=[Book1]Sheet1!(B,A) method:=linear option:=extrap;

The above example would interpolate X values from Y values assuming I had the columns set up like this: col(A):X1, col(B):Y1, col(C):X2 (blank), col(D):Y2 (values at which X2 will be interpolated)

Let me know if this is successful.

Best,


Nicholas G.
nicholas@originlab.com
OriginLab Technical Support Team
Go to Top of Page

J.S.Schulte

Germany
11 Posts

Posted - 06/14/2024 :  04:59:16 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Nicholas,

I am looking for the Find X/Y function/table documented here:
https://www.originlab.com/doc/en/Quick-Help/Find-XY-Table

You can activate the function as an option in the NLFIT dialog.
After the adjustment, the FitNLFindXfromY1 sheet is generated, in which you can enter defined y-values. The corresponding X values are then calculated based on the fit parameters.

However, it is not documented if and how I can enable this option using a LabTalk-script.

My current script looks like this:
range rP=col(2);
peakindex=list(max(rP),rP);
range fitX=col(1)[peakindex:end];
range fitY=col(2)[peakindex:end];
nlbegin iy:=(fitX,fitY) func:=expdec2 nltree:=ParamTree;
nlfit;
nlend 1;

The script performs a curve fit from the peak to the end of my data. I then want to use the Find X/Y function to calculate X values from certain Y thresholds. To do this, however, I need to be able to call the Find X/Y function.

Best,
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