The codes described here are designed to minimize

 

 

with respect to the components of the vector c.  Most minimization problems can be put into this form. 

The key routine in accomplishing this is

The most recent code for minimizing this along with a document with comments is in robmin.zip.  For the straightforward minimization of c2(c) without the intermediate fA form, I recommend the Amoeba. ..\class2K\optimization\amoeba\AMOEBA.htm  This is much slower but easier to code.

          To run with watfor the command is

C:\PUBLIC~1\nlfit\for>e nlfit

Look at the last few lines of nlfit

20    RETURN

      END

c$include gpoly  The polynomial for finding FA and its first derivatives. 

C#INCLUDE POLY

c#include dfpoly

c#include POLYARRD

c#include arrhpoly

C#INCLUDE \GREEN\ROBMIN

C#INCLUDE COPYOF~1

C$INCLUDE ROBMIN

C#INCLUDE MAOPEN  Commented out with a # for using Watcom -  needs to be a $ for watfor

C#INCLUDE WSYSTEM  Commented out with a # for using Watcom -  needs to be a $ for watfor

 

A sample direction file is for\GAUSS.DIR

 

To use Watcom put a hashmark in the last two includes above.  Nlfit.wpj is in the for file while the Watcom specific file is in the WCOM folder. 

 

          I have recently checked compilation in linux.  This lead to the intruduction of a usystem.for containing the translations of the system codes for passing command line arguments and making system calls.  I also included a bit of a makefile in the setup along with a read.me.  This codes are in nlfitunix.zip.  See also GregD.htm.

          A set of documents developed with Don Haynes in 1995 are in ../haynes95/Working/readme.htm.  These have specific applications to the kinds of fits of interest in analyzing X-ray lines from lasers impinging on pellets.

          Derivations and description of the various algorithms were discussed in the first section of../class01/plan01.htm#Nlfit with links back to this.

          An annotated code with links to the derivations is in NLFIT.HTM.  This file contains very explicit directions for making and using the code.

          The nlfit folder contains a file mkdffit.bat.  This file compiles the Fortran for the fit in terms of the derivative of the Fermi function using MS FORTRAN 5.2 making the code dffit.  The data is 1-5cell.dat, which was digitized off of some graphs involving gas data by Alex Green’s group.  It should be well fitted by dffit.  The fit comes out in the file fit.dat.  I use errgplot to plot one on top of the other.  The executable for this is included -- I wrote it and also a Windows 95 version so it is free for general use.  The various doc files describe the code in detail, the derivatives and a few graphs.  These are word 6 files.

Directions for fitting data

          1. First plot your data.

              Both of the trial data sets had a single wild point.  This destroys any genuine least squares routine.  Find these points and remove them.

          2. Note that the routine needs the estimated error on each data point.

Either add it to the data set or change nlfit.for just after the data is read to include it.

          3.  Make a direction file modeled on the appropriate fit.dir file.  It is best to fix some of the constants on the first pass.