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
 Forum for Origin C
 Orthogonal Distance Regression
 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@y

Germany
29 Posts

Posted - 01/20/2017 :  04:40:16 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello everyone,
I found out there is a new functionality in OriginPro 2017 called "Orthogonal Distance Regression" (http://www.originlab.com/doc/Tutorials/Nonlinear-fitting-using-orthogonal-regression).
Could someone provide an example in OriginC (or LabTalk) how to use it for data fitting with some function built in Origin, e.g., "Power1"?
Many thanks for your help in advance!

PS: At the bottom of the page above, there are two links available in "You can refer to this page for the details of the algorithm of ODR as well as Levenberg Marquardt (L-M) algorithm. Another example of using Orthogonal Distance Regression for Implicit Functions can be found here." The first one does not contain any OriginC example and the second one is broken.
---
Origin Ver. and Service Release (Select Help-->About Origin): OriginPro 2017 (64-bit), b9.4.0.220
Operating System: Windows 10 Pro (64-bit)

yuki_wu

896 Posts

Posted - 01/20/2017 :  06:05:37 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

I just come up with an example by using the X-Funtion xop:

//First import the desirable data into a new book
 
filename$ = system.path.program$ + "Samples\Curve Fitting\Gaussian.dat";
 
newbook;
 
impASC filename$;
 
//Use the NLSF class to create a GUI tree "nlGUI"
tree nlGUI;
xop execute:=init classname:=FitNL iotrgui:=nlGUI;
 
//Specify function and input data, then update operation tree before fitting.
 
nlGUI.GUI.FunctionSelection.FunctionList$="Gauss";

nlGUI.GUI.FunctionSelection.fitmethod=1; //Use ODR
 
nlGUI.GUI.InputData.Range1.X$=Col(A);
 
nlGUI.GUI.InputData.Range1.Y$=Col(B);


xop execute:=update iotrgui:=nlGUI;

xop execute:=report iotrgui:=nlGUI;
 
//Clean up operation objects after fit
 
xop execute:=cleanup;

More information about xop can be found here:
http://www.originlab.com/doc/X-Function/ref/xop

Not sure whether it is what you want. If I figure out another better example, I will get back.

BTW, the broken link has been repaired.

Regards,
Yuki
OriginLab

Edited by - yuki_wu on 01/20/2017 06:09:15 AM
Go to Top of Page

j@y

Germany
29 Posts

Posted - 01/20/2017 :  11:44:12 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello Yuki,
Problem solved. Using "nlfSession", the "Orthogonal Distance Regression" can be selected by declaring "FITMETH_ORTHOGONAL_DISTANCE_REGRESSION". Still, it does not do what I would expect. Have to tune "SetParamBounds" and "SetTolerance"...
All the best. j
Go to Top of Page

yuki_wu

896 Posts

Posted - 01/22/2017 :  01:06:39 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi J,

Glad to hear that you resolved the problem.

Yes, we can specify the iteration algorithm by method NLFitSession::Iterate:
http://www.originlab.com/doc/OriginC/ref/NLFitSession-Iterate

Regards,
Yuki
OriginLab

Edited by - yuki_wu on 01/22/2017 01:07:24 AM
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