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
 Origin Forum
 NonLinear Curve Fitting Param Init Script

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
ckyu Posted - 07/02/2014 : 5:21:33 PM
Origin Ver. and Service Release (Select Help-->About Origin):
Origin 9.1.0
Operating System: Windows 7

Hello,
I am trying to create an analysis template using NLFit.

Background
I have three parameters: a, b, and g. a and b are varying, but g is a fixed number.

Purpose
I am running an Automation Server in Excel. I plan on performing Batch Processing using VBA or executing LabTalk Commands (if this is possible) using oApp.Execute. oApp, being an instance of the Origin Application.

Requirement
I need to have it so g is set to a fixed variable read from the Origin Worksheet.

Attempt
I tried to do the following in the Parameter Init tab of the NLFit window, but it did not work:

range ry = [Data]Sheet1!Col(2)
g = ry[1] // set g to row 1, col 1 of Sheet1 in Data Wbk


I also need to set it so g is fixed.

Alternative
I understand I can do this easily in the command window using LabTalk, but if I execute curve-fitting in LabTalk, Origin does not let me save it as an Analysis Template and I cannot do any Batch Processing.
If anyone knows a way to create an Analysis Template or any Origin Document Type that automatically runs a series of LabTalk commands, that will be great.

Thank you very much for your help.
2   L A T E S T    R E P L I E S    (Newest First)
ckyu Posted - 07/03/2014 : 12:25:24 PM
I added those lines to the Origin C Fitting Function, but it unfortunately does not initialize the variable.
I did:
Dataset ds("Book1", 1);
g = ds[0];
//function here

to initialize g to the first value in the 2nd column of Book1.

When performing fitting, I got this error:
Fit did not converge - Parameter(s) g are not properly initialized. Please check and correct their values.



The only way I got it to work is if I delete g from the parameters and declare it like so:

double g;
Dataset ds("Book1", 1);
g = ds[0];
//function here


Since NLFit does not accept a blank: "--" in the value field and g is a constant.

Thank you for the help, jasonzhao!
jasonzhao Posted - 07/03/2014 : 08:59:31 AM
Hi,
Please try this way for fitting with Analysis Template, the Fitting function is created with Origin C.

After defining variables and the function body, we should insert code below in the function body and initialization code, to set one parameter fixed and get values from the Origin Worksheet. Here’s the example code which defines the parameter w follows the first cell in Book1 col(a):
Dataset ds("Book1", 0);
w = ds[0];

Then, you can conduct the nonlinear fit with this fitting function and save workbook as an analysis template, which can be used in batch process.
For further questions in fitting, don’t hesitate to contact us by mail: tech@originlab.com with your data and .fdf Function file.

Best regards,
Jason Zhao
OriginLab Tech Service

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