FIT 0.9


A fitting program for the HP48 by Frank Gutermuth

This page contains a short description of the program FIT, which can 
do a least squares fit of an arbitrary function to a set of (X,Y) data 
points with an HP48.


Quick start 

Installing

After you have transferred the file FIT_09.48 to your HP48, just run 
it. Thereby, all necessary parts of the program will be installed 
automatically. The directory FIT will be added to your HOME directory. 
FIT contains several files: USIN, GNEW, MARQ, ERROR. You can delete 
FIT48 after the first run. It serves as a self-installing archive.


Getting started

The installing process includes the assignement of a user key. 
Executing USR 5 (by pressing "left arrow", "alpha" and "5" one after 
the other) starts the User Interface USIN which requests the needed 
information and selects the proper program steps. For most purposes, 
this should be all you have to know about FIT48.
		
Some remarks

	o You can fix parameters in the expression by excluding them 
	  from the parameter list. 
	o The sum of the least squares is stored in the variable \Gs2 (#). 
	  It can serve as an indicator for the quality of the fit. 
	o You can use the built in HP48 functions to manipulate or 
	  analyse the data and the expression in conjunction with 
	  FIT48 because the same variables are used (\GSDAT (#) and EQ).

(#) During data-transfer from a HP48 to a PC some of the HP48 
characters have to be translated to standard ASCII characters. \Gs 
represents the lower case, \GS the upper case greek letter sigma 
according to the HP48 translation code 3.

2)	An example
Assume you have the following data matrix:
[[1 1.3 0.11]
[2 2.2 0.30]
[3 3.6 0.42]
[4 5.0 0.44]
[5 6.8 0.71]] (toc)
The X-values of your data points have to be placed in the first and the 
corresponding Y-values in the second column of the matrix. The standard 
errors for the Y-values in the third column are optional. Store the 
data in the statistical matrix \GSDAT of the HP48. You may wish to gain 
a plot of your data with the built in HP48 command SCATRPLOT. Now you 
are ready to execute USR 5. If there is no \GSDAT in the current 
directory, the program activates the statistic menue and asks you to 
store your data in \GSDAT. After you have done so, you can continue 
with CONT (by pressing "ON" after "left arrow").

In the next step you are prompted for the expression to be fitted. In 
our example this shall be a straight line through the origin. So enter 
'A*X'. It is important, that the independent variable is the capital 
'X'. The list of the parameters is { A } in this case. Obviously the 
expression 'A*X' is linear in { A }. After a few seconds calculation 
time you find the standard error for 'A' in the stack (0.057). The 
calculated value for the parameter A is stored in the current 
directory (1.251).

It is worse to mention that for linear expressions (means linear in the 
parameters you want to vary, 'A*SIN(X)+B*EXP(X)' is linear in { A B }) 
the parameters are calculated in an algebraic way. Whereas in the case 
of non-linear expressions numerical iterations have to be done. If you 
fit non-linear expressions you have to tell the program when you are 
satisfied with the accuracy of the iteration process. Also a starting 
value for each parameter is needed to begin with the iteration at a 
certain point. Bad starting values may lead the minimization process to 
a relative minimum away from the absolute minimum or cause an infinite 
result. An educated guess (with the help of the plotting functions of 
the HP48) will reduce the calculation time.


A more detailed approach

Sorry, but I have not had the time to write a sophisticated and 
detailed description. In fact, I wrote FIT48 absolutely for my own 
usage. One of my collegues here in the Strahlenzentrum der 
Justus-Liebig-Universitt Gieen sparked me to designing what I 
call user interface. I hope this will enable others to use my program.


Restrictions

You may use and copy FIT48 if you agree to the following: 
	o You use FIT48 absolutely at your own risk. 
	o You can not charge me for anything. 
	o You may modify FIT48 for your own purposes only. 
	o You may not redistribute a modified or incomplete version. 
	o You must not make money with FIT48 without my permission.

Please let me know your opinion about FIT48. Also, if you have any 
problems or ideas for improvement, please contact me.

Frank Gutermuth
Strahlenzentrum der
Justus-Liebig-Universitt Gieen
Abteilung Biophysik
Leihgesterner Weg 217
35392 Gieen
Germany

Frank.Gutermuth@strz.uni-giessen.de