If you are fortunate enough to be using the `LINUX' operating system on an x86 processor, you will be able to use the example executable programs (ELF format). Otherwise, you can still try out the software by compiling the source code extracts provided.
matsol
solves a matrix equation
The program uses a library routine which solves the equation using Givens rotations to make A upper-triangular then back-substitution to find x.
matsol < matsol.datto read data from file
matsol.dat
.
The solution is written to standard output.
number_of_rows number_of_columns For each row i in A: For each column j in A: A(i,j) For each element i of y: y(i)e.g.
2 2 1.5 2.3 -5.8 9.0 -1.2 7.3
polyfit
fits a set of (x,y) data points with
a polynomial
The program uses a library routine which performs the fit by building an overdetermined matrix describing the problem, and solving to find a least-squares solution for the coefficients ci.
The program can also plot the data and polynomial fit, using calls to the Bubblesoft Graphics Library. The executable provided calls the X-Windows version of this library.
If you're interested in details, the sample data was generated
by taking the function
y = 0.56 - 2.8 x + 3.5 x2
of a set of x-values, and adding random noise with uniform distribution
from 0 to 0.2.
polyfit < polyfit.datto read data from file
polyfit.dat
.
The coefficients ci and residue are written to standard output,
and a window opened to display the data and fit if X-Windows is running.
number_of_data_points For each data point: x y weight number_of_polynomial_coefficients xmin xmax ymin ymax number_of_line_segmentswhere
xmin
etc are the x and y limits for the graphical display.
number_of_line_segments
tells the program how many to
use. The higher the number, the smoother the curve.
5 0.5 0.6 0.6 0.75 0.7 0.9 0.8 0.89 0.9 0.95 3 0.0 1.0 0.0 1.0 100
To compile the programs:
matsol_nolib
and datafit_nolib
.
make
(or make program_name
,
where program_name
is one or more of the program names).