File: curvefit.doc

package info (click to toggle)
pgplot5 5.2.2-19.3
  • links: PTS
  • area: non-free
  • in suites: buster, stretch
  • size: 7,136 kB
  • ctags: 6,763
  • sloc: fortran: 39,792; ansic: 22,549; objc: 1,534; sh: 1,298; makefile: 385; perl: 234; pascal: 233; tcl: 190; awk: 51; csh: 25
file content (156 lines) | stat: -rw-r--r-- 9,499 bytes parent folder | download | duplicates (15)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
c-------------------------------------------------------------------------------
c
c                                   CurveFit
c
c         A general curve fitting routine using PGPLOT graphics.  It works on
c      VAX/uVAX systems, possibly any system running PGPLOT.
c
c         CurveFit will plot up to 30 data sets (a maximum of 2500 points for
c      each data set, a maximum of 24000 points total for one graph), saved
c      as (xp,yp) in ascending {xp} order.  Different data sets in one file
c      must be separated by one non-numeric line.  CurveFit can also modify the
c      data set, by flipping the x and y axes and/or taking logarithms of
c      either or both of them.  Labels and title can be added to the plots.
c      In addition, CurveFit allows one to fit various types of curves to the
c      data sets.  These are:
c
c           (a)  straight line (connect the dots)
c           (b)  cubic spline
c           (c)  smoothing (Bezier) polynomial
c           (d)  low-pass Fourier transform filter
c           (e)  a best-fit polynomial of up to 10 terms
c
c         CurveFit is menu driven and allows one to display all intermediary
c      results.  The x,y plotting ranges are user determined, as is the
c      fitting range (over the x coordinate).  Each type of fit can only be
c      used once with each data set, though different fits may be used with
c      the same data set (however, one could load the data set in again and do
c      the same fit over a different range).  Different data sets can have
c      different symbols and line styles/widths associated with them, so they
c      can be differentiated.  The manner in which the line styles/widths is
c      determined can be changed if the user so desires, as can the symbols
c      used to plot the data points.  Plots can be made on any device that is
c      supported by PGPLOT.
c
c         The programme is fairly well documented.  A subsantial amount of
c      virtual memory is required (of the order of 7 Mb), but this can be
c      decreased by lowering the number of data points that may be plotted.
c      The following are pseudo-global variables that must be changed in each
c      subroutine in order for the programme to work.
c
c           MAXPOINTS    the maximum number of points allowed per graph
c           MAXPOINTSET  the maximum number of data points per data set
c           MAXDATASET   the maximum number of data sets per graph
c           NCOEFF       the maximum number of coefficients for polynomial
c                            fitting
c           S2           gives the extra number of points calculated by the
c                            curve fitting routines to make the curves look
c                            smooth, given as 4*MAXPOINTS or 8*MAXPOINTS
c
c         The Bezier polynomial fitting is taken from Borland's TURBO Graphix
c      Toolbox (translated into FORTRAN), while the cubic spline routines
c      are partially taken from there, and partially my own algorithm.  The
c      polynomial fitting and the fast Fourier transforms are taken from
c      the book Numerical Recipes by W.H. Press et al.  Except as noted below,
c      the routines all seem to do what they are supposed to.  Note that the
c      polynomial curve fitting gives the coefficients and their standard
c      deviation as well.  Take these values with a grain of salt!
c
c         Currently, everything seems to work fairly well, except for some
c      numerical difficulties with the fast Fourier transform that I am
c      unable to fathom.  The problem only becomes noticeable when the FFT
c      smoothing takes place over more than about 100 data points, when
c      anomalous step functions appear at intervals of powers of 2.  The
c      step functions get larger as more data points are being smoothed over.
c      I would appreciate a solution if anyone comes up with one.
c
c         One other minor difficulty discovered occurs when one is taking
c      logs of more than one data set.  It is possible that the endpoints
c      used for the plotting will not cover the full range of all of the
c      data sets plotted.  A fix would require several more variables, plus
c      thinking, of which I do not have time at the present.
c
c         Distribute and use this programme as you see fit.  If anyone comes
c      up with major changes or improvements, please send me a copy of the
c      source code.  If anyone wishes a current copy, send me a note, and
c      the current source code will be sent out to them.  I can be reached
c      at
c
c            BITNET:    gill@qucdnast
c            INTERNET:  gill@qucdnast.queensu.ca
c
c
c  October 27, 1987 -     Fix of subroutine Spline1.  It was able to crash
c                     with a particular spacing of {xp}.  It was also found
c                     to be incorrect.
c                         Fix to all calculation subroutines, so that the
c                     fit will be made over only the points INSIDE the
c                     given fit range, inclusively, i.e. no extrapolation.
c  October 28, 1987 -     Fix of Subroutine Spline2.  It gave discontinuous
c                     spikes at the endpoints.
c                         Add double precision calculations to Spline1 and
c                     Spline2 to allow accurate subtractions/additions.
c  November 6, 1987 -     Fix of calculation procedures that give the range
c                     of the plot.  These are now given to 2 digits accuracy.
c                         Add the option to plot or not plot the individual
c                     data points.
c  November 13, 1987 -    Fix the x,y plotting limits when new data sets are
c                     loaded.
c                         Each {xp,yp} pair must be on the same line.  Other
c                     information is now allowed on each line after {xp,yp}.
c  March 8, 1988 -        Add READDATA subroutine, that allows one to:
c                     a) skip lines at the beginning before data input,
c                     b) have up to 25 columns of data that can be accessed,
c                     c) read multiple data sets from the same file.
c  April 21, 1988 -       Fix of number of points associated with the data
c                     set number.
c                         The default video and hardcopy devices are now
c                     /VT and /IM, respectively.
c  May 30, 1988 -         Add the option of user inputed line styles/widths.
c  June 2, 1988 -         Correct the problem of bad standard deviations on the
c                     polynomial coefficients.
c                         Add REAL*8 and /G_FLOATING to all of the polynomial
c                     calculations.
c  June 13, 1988 -        Add some idiot-proofing (read `Error checking') of
c                     the curve-fitting routines.
c  July 27, 1988 -        Correct the assignments of the fitting range
c                     variables.
c  August 29, 1988 -      Add error-trapping of non-character data input.
c                         Add scaling (in x and/or y) of any data set.
c                         Add ability to toggle all line drawing and fits for
c                     any data set at any time.
c                         Add user chosen line style/line width combinations.
c                         Add user chosen data point plot symbols.  The size of
c                     these is regulated by the total number of points (more
c                     points gives smaller symbols).
c  Christmas, 1988 -      Rearrange the storage method for the data.  Now
c                     there is a maximum of 24000 points, or 30 data sets of
c                     2500 points apiece.  This should allow for more
c                     flexibility for the user.
c  June 21, 1989   -      Change the entrance into the routines to allow
c                     multiple changes to data sets without going to the
c                     main menu screen in between each change.
c                         Fix of the log routines.  Check that your machine
c                     will assign 0 to 10^-100.
c  June 22, 1989   -      Fix of number of points plotted for various fits.
c                     Now each fit may have a different number of data points.
c  July 4, 1989    -      Fix of spline calculation routines.  Splines of more
c                     than one dataset were not saved correctly or plotted.
c  July 6, 1989    -      The default line width, line style will now always
c                     be 1 and 1.
c  July 11, 1989   -      Updated the help file subroutine.
c  July 14, 1989   -      Correct the plot symbol choosing routine.
c                         More idiot-proofing.
c                         Add an UpCase function (works with ASCII only).
c  August 29, 1989 -      Change the order of commands so that the main menu
c                     will not automatically be drawn between commands.  To
c                     redraw menu, type in `R' or `M'.
c  August 31, 1989 -      Fix READDATA, so that any data read in will be from
c                     one line only.  Before, multiple lines were permitted.
c                     Also, an error message is given if the asked for column
c                     does not exist.  The column can then be chosen again.
c
c         Last revision - August 31, 1989 - Arnold Gill
c         Last revision sent to Tim Pearson (tjp@citphobo) - August 31, 1989
c
c-------------------------------------------------------------------------------