Geoscience Reference
In-Depth Information
h is plot helps us to dei ne the axis limits for gridding and contouring:
xlim
=[420 470] and
ylim
=[70 120]. h e function
meshgrid
transforms the
domain specii ed by vectors
x
and
y
into arrays
XI
and
YI
. h e rows of the
output array
XI
are copies of the vector
x
and the columns of the output array
YI
are copies of the vector
y
. We choose 1.0 as the grid interval.
x = 420:1:470; y = 70:1:120;
[XI,YI] = meshgrid(x,y);
h e biharmonic spline interpolation is used to interpolate the irregular-
spaced data at the grid points specii ed by
XI
and
YI
.
ZI = griddata(data(:,1),data(:,2),data(:,3),XI,YI,'v4');
h e option
v4
selects the biharmonic spline interpolation, which was the sole
gridding algorithm available until MATLAB4 was replaced by MATLAB5.
MATLAB provides various tools with which to display the results. h e
simplest way to display the gridding results is as a contour plot using
contour
.
By default, the number of contour levels and the values of the contour levels
are chosen automatically. h e choice of the contour levels depends on the
minimum and maximum values of
z
.
contour(XI,YI,ZI)
Alternatively, the number of contours can be chosen manually, e.g., ten
contour levels.
contour(XI,YI,ZI,10)
Contouring can also be performed at values specii ed in a vector
v
. Since the
maximum and minimum values of
z
are
min(data(:,3))
ans =
-27.4357
max(data(:,3))
ans =
21.3018
we choose
v = -40 : 10 : 20;
h e command
[c,h] = contour(XI,YI,ZI,v);