The y-value at which to interpolatey
The x-value at which to interpolatex
3x3 matrix of the table z-valueszmat
Three-element list of the table y-coordinates {y1,y2,y3}yl
Three-element list of the table x-coordinates {x1,x2,x3}xl
The z-values are passed as a 3x3 matrix only because that is a convenient way for the user to enter
the z-values, directly as they appear in a printed table.
The first two when() functions scale x and y to u and v as shown in [7]. The last line of the function
calculates and returns the interpolation result. The augment(augment(...))
T
convertst the 3x3 z-matrix
to a single-column vector, to perform the matrix multiplication in [10]. The coefficient solution vector is
converted to a list, so that the built-in list multiplication can be used to find each term of the sum in [11].
As an example, suppose that we want to interpolate with this table at x = 0.27 and y = 0.55:
0.43500.33350.24740.3
0.38940.28600.19870.2
0.36160.25710.16920.1
0.60.50.4
So we have
xl = {.1, .2, .3}
yl = {.4, .5, .6}
zmat =
.1692 .2571 .3616
.1987 .2860 .3894
.2474 .3335 .4350
x = 0.27
y = 0.55
and the call to do the interpolation looks like
intrpz9({.1,.2,.3},{.4,.5,.6},[.1692,.2571,.3616;.1987,.286,.3894;.2474,.3335,
.435],0.27,0.55)
which returns 0.3664.
This program, intrp9ui(), provides a user interface for intrpz9().
intrp9ui()
Prgm
©UI for intrpz9()
©calls math\intrpz9, util\rq2v, util\rq3v
©calls util\copyto_h by Samuel Stearly
©31mar01/dburkett@infinet.com
local x123,y123,zz1,zz2,zz3,xy,res,xl,yl,zmat,x,y,z,inhome,errdisp
©Error message display program
define errdisp(msg)=Prgm
dialog
6 - 51