next up previous contents index
Next: Command Summary Up: Fitting of Data Previous: Outputs

Tutorial

 

A tutorial procedure ( TUTORIAL/FIT) shows how to use the fitting package in the simple case of a 1D--image consisting of two overlapping gaussians on top of a non--linear background with additional noise. It is recommended to run the tutorial while reading this section and if possible, on a graphic terminal.

Two functions are copied into your area if you run the example: TEST to generate the artificial data, and FUNCTION with the ``model'' to be fitted.

The artificial image, to be used in the example, is created as follows: First it creates a reference image, called REF, to provide the definition interval of the independent variable. Then the command COMPUTE/FUNCTION creates the 1D frame with the gaussian profiles on top of the background. Finally, some noise is added to the data. The resulting frame, PROFILE is displayed on the graphic screen.

Now the `model' FUNCTION will be fitted to the frame PROFILE, using the command FIT/IMAGE. The 'model' was copied into your area already, but you could define it using the editor as:

EDIT/FIT FUNCTION

This command allows you to create or modify FIT--files (ref Volume C of the MIDAS User guide and Appendix gif for use of the EDIT command on your terminal). In our example, the user will edit the three basic functions e.g. as follows:

1 GAUSS(X;A1,A2,A3) A1=50. A2=95. A3=45.
2 GAUSS(X;A4,A5,A6) A4=A1 A5=135. A6=A3
3 POLY(X;A,B,C) A=0. B=0. C=0.

where two of the parameters of the second gaussian, height and FWHM, are related to the parameters of the first Gaussian.

The different fitting methods are then successively applied, changing regularly the options through the SET/FIT. The exact sequence of instructions is:

SHOW/FIT
FIT/IMAGE 11,1.,0.5 PROFILE FUNCTION
SET/FIT METHOD=CGNND
SET/FIT PRINT=0
FIT/IMAGE 30,.5 PROFILE FUNCTION
SET/FIT METHOD=QN
SET/FIT PRINT=-4
FIT/IMAGE 30,.5 PROFILE FUNCTION
SHOW/FIT
SET/FIT METHOD=MGN
FIT/IMAGE 30,.5 PROFILE FUNCTION

It is possible to compare efficiency, precision and effects.

Finally, the fitted result is computed as:

COMPUTE/FIT FITTED = FUNCTION

and the fitted frame is plotted on top of the original data.

Individual components of the fit can be selected with the command SELECT/FUNCTION. In the example, the sequence of commands

SELECT/FUNCTION FUNCTION 1,3
COMPUTE/FIT FIT1 = FUNCTION
SELECT/FUNCTION FUNCTION 2,3
COMPUTE/FIT FIT2 = FUNCTION
SELECT/FUNCTION FUNCTION ALL

is used to compute the two gaussian components on top of the background. The results are also plotted.

The full compatibility between image and tabular formats for input and output means that, in our example, the fitted parameters can be used to compute fitted values in a table, using the COMPUTE/FIT command as follows:

COMPUTE/FIT table :outcol = fitname(:incol)

where table is the name of a table containing the independent variable in the column :incol, fitted values are stored in the column :outcol.

To begin with, it is advised to consult the appendix or use the MIDAS interactive HELP about EDIT/FIT, SET/FIT, CREATE/FUNCTION, REPLACE/FUNCTION, FIT, FIT/IMAGE, FIT/TABLE, COMPUTE/FIT.



next up previous contents index
Next: Command Summary Up: Fitting of Data Previous: Outputs



Pascal Ballester
Fri Mar 24 17:17:52 MET 1995