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
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Function fitting

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
66de250 Posted - 10/28/2024 : 1:07:12 PM
Dear Sirs,I need some assistance with a LabTalk script for nonlinear curve fitting.Below is my specific problem:
First, I have a user-defined function named ‘fuc’, which contains three parameters: "AA", "BB", and "CC". All three parameters have an initial value of '1'. Additionally, I have a dataset and a graph based on this data.
I need to implement the following using a LabTalk script:
Select a specific segment of the data in the graph (e.g., from the maximum value to the last value ) as the fitting range for nonlinear curve fitting.
Use the user-defined function file "fuc" as the fitting function.
Before each fitting, I need to change the initial value of parameter "CC".
Fit until convergence (when I manually operate, I find that may need click the "fit until convergence" button multiple times results in a correct fit, so in the script you need to consider how to ensure the fitting result is correct).
After convergence, I need to extract the fitted parameter "CC" and save it directly into a new worksheet at the i-th row and j-th column.
Could you provide me with a specific LabTalk code to solve this? Thank you very much!
1   L A T E S T    R E P L I E S    (Newest First)
YimingChen Posted - 10/28/2024 : 3:00:45 PM
Please check the following sample script to use the ExpDec1 fitting function to fit the sample data, and save the fitted parameter t1 to a new workbook. You may want to refer to the Labtalk Help page of nonlinear curve fitting:
https://www.originlab.com/doc/LabTalk/guide/Non-linear-Fitting


newbook;
wbook.dc.add("CSV");
wks.dc.source$=System.path.program$+"Samples\Curve Fitting\Gaussian.dat";
wks.dc.import();

int istart = list(max(Col(B)), Col(B)); // get the index of max y value
nlbegin iy:=(1,2)[istart:end] func:=ExpDec1 nltree:=ParamTree;
ParamTree.t1 = 5;
nlfit;

newbook;
Cell(1,1) = ParamTree.t1;


James

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000