Time-stamp: </wrf/matlab/interp2/Dist/README, Tue, 14 Jan 2003, 18:19:35 EST, wrf@benvolio.ecse.rpi.edu>

This is a distribution of my Matlab programs for interpolating
contour line and other elevation data, using an overdetermined
Laplacian.   It is a work in progress.

This package was assembled from various subdirs.  I haven't tested
everything, so please report any problems.  Not everything tried
here works, e.g., overdetsol on large examples.

Ref:

http://www.ecse.rpi.edu/Homepages/wrf/papers.html#vancouver98

                     ========================
Wm Randolph Franklin
wrf@ecse.rpi.edu (Plaintext preferred; attachments deprecated)
http://www.ecse.rpi.edu/Homepages/wrf/



================================================================

How the square test case was made:

The test case is 4 concentric squares in a 48x48 image.
How it was created:

1. Make square1.gif with xpaint.

2. Read it with xv, correct the colors, and write square.pgm.

3. Cut the header, split into lines, and write square.dat for the
programs to read.

================================================================

Test data:

Each test case has a compressed dat file, for Matlab to read, and
a pgm file, containing the same data as an image.  All the test
cases, except square, are from Mike Gousie.   Three of them are
real data.


bountiful
crater
mt257
square
tuckermans



================================================================

General programs:


DETSOL(Z): Do a determined solution of the elevation points in the
square matrix Z.  Unknown entries are 0.  B is the matrix of
coefficients, and C the RHS vector.  W is the output matrix of
elevations.  The unknown entries become the average of their 2,
3, or 4 neighbors.


GRIDSOL(Z,method): Interpolate the data with a builtin matlab
method.  Do a griddata(method) solution of the elevation points in
the square matrix Z.  Unknown entries are 0.


DOGRIDS:  Call gridsol several times with different methods on the
data file Z, and plot the results.

LAGRANGE: Plot a Lagrange interpolation to a step function.  This
is not directly related to anything else here.   It is included as
an excellent example of how counterintuitive interpolation can
be. 


OVERDETSOL:  [W,V] = overdetsol(Z,R)

Do an overdetermined solution of the elevation points in the
square matrix Z.  The unknown entries in Z marked by 0s.  Each
known entry has an equation defining it to be its known value. All
entries, known and unknown, are defined to be the average of their
4 neighbors.  If an element doesn't have 4 neighbors, i.e., is on
the border, then don't make an equation.  These latter equations
are weighted by R relative to the former equations defining the
known entries.  R very small will approximate a determined
solution.  R very large will produce a surface of 0 divergence
that ignores the known points.
 
If R==0 then call detsol and don't refine.

Overdetsol is the major program for this project.


PLOTDIAG: Plot the gridsol solutions along a diagonal cut of the
surfaces.   To be called after dogrids.


PLOTSTUFF: Plot some solutions produced by overdetsol.


PROC*: Main programs to call overdetsol several times on Z, with
different R.


================================================================

Programs to process specific datasets:

Some of these haven't been updated.  They are included since they
may still be somewhat useful.

proctuck.m
procmt257.m
procmt257a.m


