MATLAB Mathematics - SERC - Index of
MATLAB Mathematics - SERC - Index of
MATLAB Mathematics - SERC - Index of
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
2 Polynomials and Interpolation<br />
Interpolation <strong>of</strong> Three-Dimensional Data<br />
The function interp3 performs three-dimensional interpolation, finding<br />
interpolated values between points <strong>of</strong> a three-dimensional set <strong>of</strong> samples V.<br />
You must specify a set <strong>of</strong> known data points:<br />
• X, Y, and Z matrices specify the points for which values <strong>of</strong> V are given.<br />
• A matrix V contains values corresponding to the points in X, Y, and Z.<br />
The most general form for interp3 is<br />
VI = interp3(X,Y,Z,V,XI,YI,ZI,method)<br />
XI, YI, and ZI are the points at which interp3 interpolates values <strong>of</strong> V. For<br />
out-<strong>of</strong>-range values, interp3 returns NaN.<br />
There are three different interpolation methods for three-dimensional data:<br />
• Nearest neighbor interpolation (method = 'nearest'). This method chooses<br />
the value <strong>of</strong> the nearest point.<br />
• Trilinear interpolation (method = 'linear'). This method uses piecewise<br />
linear interpolation based on the values <strong>of</strong> the nearest eight points.<br />
• Tricubic interpolation (method = 'cubic'). This method uses piecewise cubic<br />
interpolation based on the values <strong>of</strong> the nearest sixty-four points.<br />
All <strong>of</strong> these methods require that X, Y, and Z be monotonic, that is, either always<br />
increasing or always decreasing in a particular direction. In addition, you<br />
should prepare these matrices using the meshgrid function, or else be sure that<br />
the “pattern” <strong>of</strong> the points emulates the output <strong>of</strong> meshgrid.<br />
Each method automatically maps the input to an equally spaced domain before<br />
interpolating. If x is already equally spaced, you can speed execution time by<br />
prepending an asterisk to the method string, for example, '*cubic'.<br />
Interpolation <strong>of</strong> Higher Dimensional Data<br />
The function interpn performs multidimensional interpolation, finding<br />
interpolated values between points <strong>of</strong> a multidimensional set <strong>of</strong> samples V. The<br />
most general form for interpn is<br />
VI = interpn(X1,X2,X3...,V,Y1,Y2,Y3,...,method)<br />
1, 2, 3, ... are matrices that specify the points for which values <strong>of</strong> V are given.<br />
V is a matrix that contains the values corresponding to these points. 1, 2, 3, ...<br />
2-16