MATLAB Mathematics - SERC - Index of

MATLAB Mathematics - SERC - Index of MATLAB Mathematics - SERC - Index of

serc.iisc.ernet.in
from serc.iisc.ernet.in More from this publisher
15.11.2014 Views

2 Polynomials and Interpolation −47.95 −48 −4000 −48.05 −48.1 −48.15 −4000 −3500 −3000 −2500 −3500 −4000 Latitude −48.2 −48.25 −48.3 −4000 −2000 −3000 −3500 −1000 −2500 −2000 −1500 −3000 −3500 −48.35 −4000 −4000 −48.4 −48.45 210.8 211 211.2 211.4 211.6 211.8 Longitude The arguments for meshgrid encompass the largest and smallest x and y values in the original seamount data. To obtain these values, use min(x), max(x), min(y), and max(y). Closest-Point Searches. You can search through the Delaunay triangulation data with two functions: • dsearch finds the indices of the (x,y) points in a Delaunay triangulation closest to the points you specify. This code searches for the point closest to (211.32, -48.35) in the triangulation of the seamount data. xi = 211.32; yi = -48.35; p = dsearch(x,y,tri,xi,yi); [x(p), y(p)] ans = 211.3400 -48.3700 • tsearch finds the indices into the delaunay output that specify the enclosing triangles of the points you specify. This example uses the index of the 2-24

Interpolation enclosing triangle for the point (211.32, -48.35) to obtain the coordinates of the vertices of the triangle: xi = 211.32; yi = -48.35; t = tsearch(x,y,tri,xi,yi); r = tri(t,:); A = [x(r) y(r)] A = 211.3000 -48.3000 211.3400 -48.3700 211.2800 -48.3200 Voronoi Diagrams Voronoi diagrams are a closest-point plotting technique related to Delaunay triangulation. For each point in a set of coplanar points, you can draw a polygon that encloses all the intermediate points that are closer to that point than to any other point in the set. Such a polygon is called a Voronoi polygon, and the set of all Voronoi polygons for a given point set is called a Voronoi diagram. The voronoi function can plot the cells of the Voronoi diagram, or return the vertices of the edges of the diagram. This example loads the seamount data, then uses the voronoi function to produce the Voronoi diagram for the longitudinal (x) and latitudinal (y) dimensions. Note that voronoi plots only the bounded cells of the Voronoi diagram: load seamount voronoi(x,y) grid on xlabel('Longitude'), ylabel('Latitude') 2-25

Interpolation<br />

enclosing triangle for the point (211.32, -48.35) to obtain the coordinates <strong>of</strong><br />

the vertices <strong>of</strong> the triangle:<br />

xi = 211.32; yi = -48.35;<br />

t = tsearch(x,y,tri,xi,yi);<br />

r = tri(t,:);<br />

A = [x(r) y(r)]<br />

A =<br />

211.3000 -48.3000<br />

211.3400 -48.3700<br />

211.2800 -48.3200<br />

Voronoi Diagrams<br />

Voronoi diagrams are a closest-point plotting technique related to Delaunay<br />

triangulation.<br />

For each point in a set <strong>of</strong> coplanar points, you can draw a polygon that encloses<br />

all the intermediate points that are closer to that point than to any other point<br />

in the set. Such a polygon is called a Voronoi polygon, and the set <strong>of</strong> all Voronoi<br />

polygons for a given point set is called a Voronoi diagram.<br />

The voronoi function can plot the cells <strong>of</strong> the Voronoi diagram, or return the<br />

vertices <strong>of</strong> the edges <strong>of</strong> the diagram. This example loads the seamount data,<br />

then uses the voronoi function to produce the Voronoi diagram for the<br />

longitudinal (x) and latitudinal (y) dimensions. Note that voronoi plots only<br />

the bounded cells <strong>of</strong> the Voronoi diagram:<br />

load seamount<br />

voronoi(x,y)<br />

grid on<br />

xlabel('Longitude'), ylabel('Latitude')<br />

2-25

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

Saved successfully!

Ooh no, something went wrong!