Databases Reference
In-Depth Information
// initialize parameter values
A1=%(%W,dependataset,1); //.p1
A2=%(%W,dependataset,8); //.p2
pka = 5; //.p3
// Dependant Data (Y-Axis) to be Fit
nlsf.y$ = %(%W,dependataset);
// Independent Data (X-Axis) to be Fit
nlsf.x$ = %(%W,1);
// Total Number of Points for Fitted Curve
nlsf.xpoints = 60;
// Improve accuracy of fit
nlsf.tolerance = 1e-5;
// Perform Curve Fitting
nlsf.fit(20);
// Add the original Data to the plot
layer -i %(%W,2);
// Rescale X & Y Axis to show All data
layer -at;
// Update "FitPams" Status Object
%W!FitPams.v1 = $(nlsf.p3,.2);
%W!FitPams.v2$ = "";
%W!FitPams.v3 = $(nlsf.cod,.2);
// Rename Axis Labels
label -xb pH Buffer Values;
label -yl Absorbance;
// Close the plot Window
win -c %H;
// Delete NLSF Fitset Hidden Worksheet
win -c NLSF1;
// Clean Up all internal Objects Used in nlsf
nlsf.cleanupfitdata();
The preceding script, in essence, performs the following functions. To fully understand the
script, an understanding of the Labtalk commands nlsf, win, label, layer, and the Labtalk reserved
variables is essential. This information is readily available online and in the Origin Labtalk Manual.
The script creates a plot window, chooses the mono pKa fitting function, and initializes the NLSF
curve-fitting engine. Reasonable starting values for the undefined parameters A1, A2, and pKa are
then chosen and set. The X (pH) and Y (absorbance) data to be fitted are then chosen (in this case,
the Y-data are utilized from column 2), and a 20-iteration curve fit is performed. The fitting
parameters are then assigned to the GUI in the Worksheet showing the pKa and the cod or r 2 value
(an indication of the goodness of fit).
Finally, the windows are closed, and the NLSF fitting module is cleaned up by erasing old
fitting parameters and freeing up allocated memory. A similar Labtalk script is created for the “bis
fit” button:
// DDE Bis pKa Fitting Script
// Save the name of the current Worksheet
Search WWH ::




Custom Search