15.11.2014 Views

MATLAB Mathematics - SERC - Index of

MATLAB Mathematics - SERC - Index of

MATLAB Mathematics - SERC - Index of

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Interpolation<br />

processing. Use bicubic interpolation when the interpolated data and its<br />

derivative must be continuous.<br />

All <strong>of</strong> these methods require that X and Y be monotonic, that is, either always<br />

increasing or always decreasing from point to point. You should prepare these<br />

matrices using the meshgrid function, or else be sure that the “pattern” <strong>of</strong> the<br />

points emulates the output <strong>of</strong> meshgrid. In addition, each method<br />

automatically maps the input to an equally spaced domain before<br />

interpolating. If X and Y are already equally spaced, you can speed execution<br />

time by prepending an asterisk to the method string, for example, '*cubic'.<br />

Comparing Interpolation Methods<br />

This example compares two-dimensional interpolation methods on a 7-by-7<br />

matrix <strong>of</strong> data:<br />

1 Generate the peaks function at low resolution:<br />

[x,y] = meshgrid(-3:1:3);<br />

z = peaks(x,y);<br />

surf(x,y,z)<br />

6<br />

4<br />

2<br />

0<br />

−2<br />

−4<br />

−6<br />

3<br />

2<br />

1<br />

0<br />

−1<br />

−2<br />

−3<br />

−3<br />

−2<br />

−1<br />

0<br />

1<br />

2<br />

3<br />

2-13

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

Saved successfully!

Ooh no, something went wrong!