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
 nlsf problem with replica
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

G.Bartsch

Germany
Posts

Posted - 09/25/2006 :  07:55:29 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
i want to fit several datasets with a replica of gauss or lorentz. normally i initialize parameters by setting xc1, xc2... a1, a2... w1,w2... and y0. but after nlsf.numReplica=peaks i cant set xc1 and the other parateters any more. in the for loop i use the following for the nlsf initialization:
nlsf.msgPrompt=0;
nlsf.cleanupfitdata();
nlsf.numReplica=(pn-1);
nlsf.func$ = "LorentzForReplica";
xibegin=xindex(xmin, %A_1);
xiend=xindex(xmax, %A_1);
nlsf.xPoints = xindex(xmaxb,luminescence_1)-xindex(xminb,luminescence_1);
nlsf.dataBegin = xibegin;
nlsf.dataEnd = xiend;
nlsf.xbegin = xmin;
nlsf.xend = xmax;
and for parameter initialization i use
count=0;
for(jj=1;jj<=peaks;jj++)
{
if(pdinil_pwavel$(ii)[$(jj)]==--){};
else
{
count++;
a$(count)=pdinil_pampl$(jj)[$(ii)];
xc$(count)=pdinil_pwavel$(jj)[$(ii)];
};
};
where pdinil is a worksheet in which for every dataset the initial fit parameters (xc,a) are saved.
before the main for loop i have nlsf.init(), too.
i also tried to put the parameter initialization before the nlsf initialization but after the nlsf.numreplica it seems to forget the xc's, a's etc. with nlsf.p1, etc it seems that i can still set those values but it would be much more convenient to set the values the way mentioned before.
maybe someone has an idea what is going wrong.
thank you

Mike Buess

USA
3037 Posts

Posted - 09/25/2006 :  09:06:49 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Change the order of the func and numreplica statements...

nlsf.func$ = "LorentzForReplica";
nlsf.numReplica=(pn-1);

Mike Buess
Origin WebRing Member
Go to Top of Page

G.Bartsch

Germany
Posts

Posted - 09/25/2006 :  09:13:33 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
this setting problem suddenly disappeared after restarting the system. thanks for reading.
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 09/25/2006 :  09:35:25 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I still recommend swapping the func and numreplica lines. Otherwise, changing nlsf.func$ will reset nlsf.numreplica to zero.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 09/25/2006 09:43:01 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