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
 LabTalk Forum
 Help inputting constraints into a nlsf in ver 8.0
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

andrewdsto

Australia
Posts

Posted - 10/13/2009 :  03:44:13 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. 8.0 and Service Release 5(Select Help-->About Origin):
Operating System: XP

Hi I am trying to input constraints into a NLSF fit
but am having trouble making the fitt take note of them.

This is in response to my initial post:
http://www.originlab.com/forum/topic.asp?TOPIC_ID=7809

and I have looked at the following about accessing errors and values:
http://www.originlab.com/forum/topic.asp?TOPIC_ID=7259

my code which is a simple variation of your example in the help files is

range fitx=1, fity=4;
nlbegin (1,2) expDecay2 tt ; // initialize fitting session for the first 2 columns using Expdecay2 function;

tt.constraints=1;
tt.constr$="tt.A1 + tt.A2 <= $(limit.ymax);";

tt.x0=xvalue(limit.imax,%(activedataset$));tt.f_x0=1; // first fix the x0 value
tt.y0=0;tt.f_y0=1; // also fix y0
tt.A1=(0.9*limit.ymax); // initialise A1, T1, A2, & T2
tt.T1=1;
tt.A2=(0.1*limit.ymax);
tt.T2=4;
nlfit;
fity=fit(fitx); //now we can generate the fit curve
nlend; // all done with fitting, can terminate it now

tt.constraints=;
tt.constr$=;
tt.a1+tt.a2=;
limit.ymax=;

this code produces the following output:

TT.CONSTRAINTS=1
tt.A1 + tt.A2 <= 2.62809;
TT.A1+TT.A2=2.8588549224227
LIMIT.YMAX=2.6280916666667

clearly the constraint that tt.A1 + tt.A2 <= 2.62809; has not been followed?

Please let me know what I am doing wrong. I have tried various scenarios with the constraints. Running lnpara after the constraints commands show no constraints in the command.

however tt.=; produces
.
.
.
func = expDecay2
nfuncparams = 6.
nderivparams = 0.
nsets = 1.
replica = 0.
confc = 95.
confp = 95.
constr = tt.A1 + tt.A2 <= 2.62809;
constraints = 1.
maxiter = 400
tolerance = 1E-9


easwar

USA
1964 Posts

Posted - 10/14/2009 :  10:13:55 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

The syntax for constraint should be "A1+A2..." and not "tt.A1+tt.A2...".

However setting constraints from script is not currently working, so this is something we will need to fix.

In the mean time the only workaround appears to be for you to add the constraint to the fitting function file itself. You can do this by using the Fitting Function organizer.

Then you can access the function to fit from script and the constraint will take effect. This of course means you have to edit the function with Function Organizer every time you need to change the constraint.

Again, we are looking into fixing this, thanks for reporting the problem.

Easwar
OriginLab
Go to Top of Page

andrewdsto

Australia
Posts

Posted - 10/14/2009 :  10:45:22 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Easwar,

thanks for the quick reply.

I had originally tried with "A1 + A2 ..." as well and figured there must be something wrong.

I will stick with the old method if I need to put in constraints for the time being and look forward to the patch.


thanks Andrew
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