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
 Setting variable bounds in NLfit

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
DaveGohlke Posted - 02/10/2012 : 8:09:50 PM
Origin Ver. 8.0 SR6:
Operating System: Win 7, 32bit.

I am trying to fit a custom non-linear function for many files with varying x values and different numbers of peaks. (Each individual curve will be fit by the sum of two exponentials and several Gaussians.) Is it possible to programmatically set my Upper/Lower bounds for any variable?

Currently, if there is one peak, and I ask for two Gaussians, the function might return one good Gaussian, and then one Gaussian centered outside of my range, with an unphysical width or height.

I could hard-code my bounds in for each set of data if necessary, or manually filter the data in post-processing, but I want this to require as little human input as possible.

My first work-around has been to add two new parameters in the initialization:
maxx = max(x_data);
minx = min(x_data);

and then define my function as
y = AVB*exp(-x/tVB) + ACB*exp(x/tCB) +y0 + A1*exp(-((x-xc1)/w1)^2);
maxx; minx;
if(w1 > (maxx-minx) || xc1 > maxx || xc1 < minx)
{
A1 = 0;
xc1 = 0;
w1 =1;
}

I'm a little concerned about convergence issues with this method (I think it might risk going in a loop), and would much prefer to set bounds as:
0 < w1 < max(x_data) - min(x_data)
min(x_data) < xc1 < max(x_data)
Can one adjust the bounds more variably in the parameter settings than "0(X, On)", "--(I, Off)"?

Thanks,
Dave

PS: Sorry for overwhelming the forum with consecutive topics. I figured they were distinct enough to merit it.
1   L A T E S T    R E P L I E S    (Newest First)
easwar Posted - 02/14/2012 : 12:03:30 PM
Hi Dave,

You can control the fitting programmatically by getting a tree of all parameter settings and manipulating that tree. See this wiki page for examples:
http://wiki.originlab.com/~originla/ltwiki/index.php?title=LabTalk:Curve_Fitting

This information is also in the LabTalk help files. You have version 8, so the wiki is more up to date, and some commands/options in there are only available in 8.6, so you may want to try with the 8.6 demo.

If you need more help with programming, contact tech support, or post in the LabTalk forum.

Easwar
OriginLab

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