<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <!--Converted with LaTeX2HTML 98.1p1 release (March 2nd, 1998) originally by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds * revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan * with significant contributions from: Jens Lippmann, Marek Rouchal, Martin Wilck and others --> <HTML> <HEAD> <TITLE>Tutorial</TITLE> <META NAME="description" CONTENT="Tutorial"> <META NAME="keywords" CONTENT="vol1"> <META NAME="resource-type" CONTENT="document"> <META NAME="distribution" CONTENT="global"> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <LINK REL="STYLESHEET" HREF="vol1.css"> <LINK REL="next" HREF="node138.html"> <LINK REL="previous" HREF="node136.html"> <LINK REL="up" HREF="node127.html"> <LINK REL="next" HREF="node138.html"> </HEAD> <BODY > <!--Navigation Panel--> <A NAME="tex2html2271" HREF="node138.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="icons.gif/next_motif.gif"></A> <A NAME="tex2html2267" HREF="node127.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="icons.gif/up_motif.gif"></A> <A NAME="tex2html2261" HREF="node136.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="icons.gif/previous_motif.gif"></A> <A NAME="tex2html2269" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="icons.gif/contents_motif.gif"></A> <A NAME="tex2html2270" HREF="node216.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="icons.gif/index_motif.gif"></A> <BR> <B> Next:</B> <A NAME="tex2html2272" HREF="node138.html">Command Summary</A> <B> Up:</B> <A NAME="tex2html2268" HREF="node127.html">Fitting of Data</A> <B> Previous:</B> <A NAME="tex2html2262" HREF="node136.html">Outputs</A> <BR> <BR> <!--End of Navigation Panel--> <H1><A NAME="SECTION001360000000000000000"> </A> <A NAME="tutorial"> </A> <BR> Tutorial </H1> <P> A tutorial procedure (<TT>TUTORIAL/FIT</TT>) 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. <P> Two functions are copied into your area if you run the example: <TT>TEST</TT> to generate the artificial data, and <TT>FUNCTION</TT> with the ``model'' to be fitted. <P> The artificial image, to be used in the example, is created as follows: First it creates a reference image, called <TT>REF</TT>, to provide the definition interval of the independent variable. Then the command <TT>COMPUTE/FUNCTION</TT> creates the 1D frame with the gaussian profiles on top of the background. Finally, some noise is added to the data. The resulting frame, <TT>PROFILE</TT> is displayed on the graphic screen. <P> Now the `model' <TT>FUNCTION</TT> will be fitted to the frame <TT>PROFILE</TT>, using the command <TT>FIT/IMAGE</TT>. The 'model' was copied into your area already, but you could define it using the editor as: <BLOCKQUOTE> <TT>EDIT/FIT FUNCTION</TT></BLOCKQUOTE> <P> This command allows you to create or modify <TT>FIT</TT>-files (ref Volume C of the MIDAS User guide and Appendix <A HREF="node198.html#site-specific-implementation">C</A> for use of the EDIT command on your terminal). In our example, the user will edit the three basic functions e.g. as follows: <BLOCKQUOTE> <TT>1 GAUSS(X;A1,A2,A3) A1=50. A2=95. A3=45. <BR> 2 GAUSS(X;A4,A5,A6) A4=A1 A5=135. A6=A3 <BR> 3 POLY(X;A,B,C) A=0. B=0. C=0.</TT></BLOCKQUOTE>where two of the parameters of the second gaussian, height and FWHM, are related to the parameters of the first Gaussian. <P> The different fitting methods are then successively applied, changing regularly the options through the <TT>SET/FIT</TT>. The exact sequence of instructions is:<BLOCKQUOTE> <TT>SHOW/FIT <BR> FIT/IMAGE 11,1.,0.5 PROFILE FUNCTION <BR> SET/FIT METHOD=CGNND <BR> SET/FIT PRINT=0 <BR> FIT/IMAGE 30,.5 PROFILE FUNCTION <BR> SET/FIT METHOD=QN <BR> SET/FIT PRINT=-4 <BR> FIT/IMAGE 30,.5 PROFILE FUNCTION <BR> SHOW/FIT <BR> SET/FIT METHOD=MGN <BR> FIT/IMAGE 30,.5 PROFILE FUNCTION <BR></TT></BLOCKQUOTE> <P> It is possible to compare efficiency, precision and effects. <P> Finally, the fitted result is computed as:<BLOCKQUOTE> <TT>COMPUTE/FIT FITTED = FUNCTION</TT></BLOCKQUOTE>and the fitted frame is plotted on top of the original data. <P> Individual components of the fit can be selected with the command <TT>SELECT/FUNCTION</TT>. In the example, the sequence of commands<BLOCKQUOTE> <TT>SELECT/FUNCTION FUNCTION 1,3 <BR> COMPUTE/FIT FIT1 = FUNCTION <BR> SELECT/FUNCTION FUNCTION 2,3 <BR> COMPUTE/FIT FIT2 = FUNCTION <BR> SELECT/FUNCTION FUNCTION ALL</TT></BLOCKQUOTE>is used to compute the two gaussian components on top of the background. The results are also plotted. <P> 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 <TT>COMPUTE/FIT</TT> command as follows: <BLOCKQUOTE> <TT>COMPUTE/FIT table :outcol = fitname(:incol)</TT></BLOCKQUOTE>where <TT>table</TT> is the name of a table containing the independent variable in the column <TT>:incol</TT>, fitted values are stored in the column <TT>:outcol</TT>. <P> To begin with, it is advised to consult the appendix or use the MIDAS interactive <TT>HELP</TT> about <TT>EDIT/FIT, SET/FIT, CREATE/FUNCTION, REPLACE/FUNCTION, FIT, FIT/IMAGE, FIT/TABLE, COMPUTE/FIT</TT>. <P> <HR> <!--Navigation Panel--> <A NAME="tex2html2271" HREF="node138.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="icons.gif/next_motif.gif"></A> <A NAME="tex2html2267" HREF="node127.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="icons.gif/up_motif.gif"></A> <A NAME="tex2html2261" HREF="node136.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="icons.gif/previous_motif.gif"></A> <A NAME="tex2html2269" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="icons.gif/contents_motif.gif"></A> <A NAME="tex2html2270" HREF="node216.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="icons.gif/index_motif.gif"></A> <BR> <B> Next:</B> <A NAME="tex2html2272" HREF="node138.html">Command Summary</A> <B> Up:</B> <A NAME="tex2html2268" HREF="node127.html">Fitting of Data</A> <B> Previous:</B> <A NAME="tex2html2262" HREF="node136.html">Outputs</A> <!--End of Navigation Panel--> <ADDRESS> <I>Petra Nass</I> <BR><I>1999-06-09</I> </ADDRESS> </BODY> </HTML>