15.11.2014 Views

MATLAB Mathematics - SERC - Index of

MATLAB Mathematics - SERC - Index of

MATLAB Mathematics - SERC - Index of

SHOW MORE
SHOW LESS

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 />

Interpolating N-Dimensional Data<br />

Use the griddatan function to interpolate multidimensional data, particularly<br />

scattered data. griddatan uses the delaunayn function to tessellate the data,<br />

and then interpolates based on the tessellation.<br />

Suppose you want to visualize a function that you have evaluated at a set <strong>of</strong> n<br />

scattered points. In this example, X is an n-by-3 matrix <strong>of</strong> points, each row<br />

containing the (x,y,z) coordinates for one <strong>of</strong> the points. The vector v contains<br />

the n function values at these points. The function for this example is the<br />

squared distance from the origin, v = x.^2 + y.^2 + z.^2.<br />

Start by generating n = 5000 points at random in three-dimensional space, and<br />

computing the value <strong>of</strong> a function on those points:<br />

n = 5000;<br />

X = 2*rand(n,3)-1;<br />

v = sum(X.^2,2);<br />

2-34

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!