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
 NLFitSession not powerful enough
 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/21/2017 :  08:12:56 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi everyone,

I struggle with using 'NLFitSession' in OriginC. Suppose I want to fit 'Power1' function, i.e., y = a*|x-b|^c to my data. Sometimes, I want to fit all three parameters, sometimes, I set 'c' as fixed and want to find 'a' and 'b'. All 'a', 'b' and 'c' are, in principal, real.

In any case, I have to impose constraints through "SetParamBounds", otherwise the fit ends up with nonsensical results. However, likely due to those constraints, the 'NLFitSession' often stops shortly after its start without changing the initial guess values much or at all, or it gets stuck at some local, incorrect extremum (often one of the parameters is equal to one of the bounds and the rest of parameters do not even correspond to the appropriate extremum when fitting stops). But since I can fit the data elsewhere, I know a reasonable solution exists.

Is there some way how to make the 'NLFitSession' more robust so that it tests the results in the course of iterations whether it really is the global extremum? Or is it completely up to the user to, e.g., intentionally randomize the parameters in the course of iterating to ensure the process does not stop in a local extremum? Or am I overlooking some other function for non-linear fitting which is available in Origin? As far as I know, Mathematica or National Instruments SW incorporate much more powerful a faster optimization engines that take care of all that.

Many thanks for any suggestion and sharing your experiences...
---
OriginPro 2017, Win 10 Pro

Edited by - j@y on 01/22/2017 02:24:22 AM

yuki_wu

896 Posts

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

Not sure whether the problem is caused by wrong data. Perhaps you should check your data at first. You can run the fitting in Origin’s GUI to fit one of the dataset, and then check if you run into the same issue.

In Origin’ GUI, it is strongly recommended to set the parameter bounds in the Bounds tab of NLfit dialog instead of in the Constraints item of Code tab.



Regards,
Yuki
OriginLab

Edited by - yuki_wu on 01/22/2017 03:13:16 AM
Go to Top of Page

j@y

Germany
29 Posts

Posted - 01/22/2017 :  02:31:49 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Yuki,
well, setting parameter bounds via 'nlfitssession.SetParamBounds' is what I am using (see the 2nd paragraph), and it is a kind of constraints, too.
The data are what they are. It has no meaning to discard 99 % of data just because Origin cannot fit them...
Go to Top of Page

yuki_wu

896 Posts

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

I knew what you were talking about. I just suggested you could try the NLFit dialog in Origin’s GUI to see if you would run into the same issue, so that we would know more info to figure out what went wrong.

If you are sure you can do fitting perfectly in NLFit dialog, would you mind sending us your code and data file with a note mentioning this forum post?

You can find the contact information here: http://www.originlab.com/index.aspx?go=COMPANY/ContactUS

Regards,
Yuki
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