There have been some recent posts about interpolating data.
Attached below is a worksheet that shows some possibilities, with the functionality centering on the CurveFitting:-ArrayInterpolation command.
This is quick summary of parts of a broader document which covers both 2-d and 3-d methods (for regular grids), where I've left out the higher-efficiency methods and instead roughed in some examples involving integration and differentiation.
I've elected not to follow the 3-d Example from the ArrayInterpolation command's help-page, although using a pre-formed grid is a very fast approach to obtain just an interpolated 3-d plot. I also prefer to use the plots:-surfdata command rather than the plots:-matrixplot command, since the former let's one get the axes' tickmarks correct for the x- and y-data ranges.
The scenario is that you have a grid of data points in two dimensions (x- and y, or P- and T-, or what have you).
For each point (ie, for each 2-d pair of values) you have an associated value (or height in z, say). Hence you actually have data points in 3-d space.
How you obtained the associated (z) values depends on your own particular data collection method, or your own program. How you got the data is irrelevant here. What matters is that you have the finite number of data values, and no other easy way to generate data values at more points (let alone data for arbitrary new points). Below, we'll just create the data (once, at the start) for this example using an entirely made-up formula.
The presumption is that you might wish to plot a smooth surface that connects the 3-d data.
But you might also wish to write some program which requires interpolated (z) values at some new (x,y) 2-d points. And you do not yet know what these 2-d point pairs are. So a pre-formed Array of points at which to interpolate may not suffice.
Instead of using a pre-formed Array of output points, we'll contruct a procedure named `B` which can be supplied with a new (x,y) 2-d output point and (if that point lies within the original range) return an interpolated (z) value.
This procedure `B` can also be plotted, using the usual `plot3d` comamnd. It won't plot quite as fast as would a pre-computed and pre-interpolated finer grid of (x,y) values, but it should plot nicely. And the surface can be made quite smooth, by merely increasing the number of plotted points using plot3d's usual numpoints option. (Maple does not currently do "adaptive" 3-d plotting, so there's also no advantage in that respect.) But `B` does solve the secondary task, of being able to compute for any subsequent (x,y) point.
We can even integrate and differentiate `B` numerically. Of course we should keep in mind that this is somewhat error prone, since on top of usual issues with numerical differentiation there is also fact that we make the choice of interpolation method! The entire interpolated surface will differ considerably according to whether a spline, cubic (or other) interpolating scheme is chosen!
We'll use P and T as the x- and y- grid points, below, since "a name is just a name" and our choice of variables is arbitarary.