Author |
Topic  |
|
Jeroen Spitael
USA
4 Posts |
Posted - 02/26/2001 : 2:48:34 PM
|
I would like to fit 3 datasets to one equation sharing 2 of the three parameters.
Using the 'Boltzmann' example of the NLSF Object documentation (online help) I can perform the fitting of multiple datasets. However, I'm unable to simulate the 'Parameter Sharing (double click to toggle) under the Select Dataset tab of the NLSF window in advanced mode...
Is there any labtalk code I can use to accomplish this? |
|
rtoomey
USA
184 Posts |
Posted - 02/27/2001 : 10:51:05 AM
|
Jeroen,
The only way to share parameters during a multiple dataset fit is by imposing linear constraints. For instance, suppose you had three datasets, each of which contained one gaussian peak. Furthermore, suppose each peak occurs at the same X value. To share each dataset's peak center, set xc, xc_2, and xc_3 equal as follows in your script:
xc=xc_2=xc_3;
I hope this helps!
Sincerely, Ryan Toomey
|
 |
|
jeroen.spi
USA
2 Posts |
Posted - 02/28/2001 : 09:14:02 AM
|
I tried this, with no luck. P1 still does not equal P4, P3 does not equal P6 (P2 and P5 are not shared)
I tried the following syntax: P1=P4; P3=P6;
P1=P1_2; P3-P3_2;
nlsf.constr$="P1=P4;P3=P6";
nlsf.constr$="P1=P1_2;P3=P3_2";
if you don't mind, I would like an example like:
nlsf.func$=Boltzmann; nlsf.numfitsets=2; nlsf.fitdata1$=Data1_B; nlsf.fitdata2$=Data2_B; nlsf.p1=0.1; nlsf.p2=4; nlsf.p3=10; nlsf.p4=0.1; nlsf.p5=1.33*p2 nlsf.p6=10; nlsf.constr$="????????????" nlsf.fit(100); |
 |
|
greg
USA
1379 Posts |
Posted - 03/07/2001 : 2:17:23 PM
|
You seem to be mixing apples and oranges. You should be using the formal parameter names for the constraints and not the enumerated 'P' names. Also, it's not at all clear from your description what exactly is being shared.
For a Boltzmann function, there should be 4 parameters (A1, A2, X0 and DX). For two datasets, that would give 8 parameters. If you go through the interface, you can share two parameters (A2 and X0 for example) which reduces the parameters to 6. Their formal names are A1, A2, X0, DX, A1_2 and DX_2 which map to P1, P2, P3, P4, P5 and P6. If you prefer script, then you should use the constraint method described by rtoomey. In this case there are 8 parameters since the constraints are used to force 'sharing' of parameters which in script looks like:
nlsf.func$=Boltzmann; nlsf.numfitsets=2; nlsf.fitdata1$=Data1_B; nlsf.fitdata2$=Data2_B; nlsf.constr$="A2=A2_2;X0=X0_2;"; nlsf.p1=160; nlsf.p2=100; // this will be 'shared' with p6 nlsf.p3=4; // this will be 'shared' with p7 nlsf.p4=1; nlsf.p5=480; nlsf.p6=100; nlsf.p7=4; nlsf.p8=1; nlsf.fit(100);
which will keep 'P2' equal to 'P6' and 'P3' equal to 'P7'. There's one small catch: There is no LabTalk control over the checkbox that Enables constraints. If you plan on using LabTalk code to run fitting with this function, then you should do a sample fit with constraints enabled and then exit Origin. You will be prompted to save changes to the Boltzmann fitting function - answer Yes. Your scripts can then disable constraints with:
nlsf.constraints$="";
Using:
nlsf.constr$="A2=A2_2;X0=X0_2;";
will turn them back on. |
 |
|
|
Topic  |
|
|
|