Page 315 - Numerical Analysis Using MATLAB and Excel
P. 315
Interpolation with MATLAB
%
% 65
%
% n =
%
% 36
%
% that is, zmax is located at zzi = Z(65)(36)
%
% the x−cordinate is found from
xmax=xi(n)
% xmax =
%
% 1.7500 % Column 36; size(xi) = 1 71
% and the y−coordinate is found from
ymax=yi(m)
% ymax =
%
% 3.2000 % Row 65; size(yi) = 1 111
% Remember that i is the row index, j is the column index, and x−axis
% varies across the rows of z and y−axis varies down the columns of z
Interpolated z is:
z_int =
500.1492
size(xi)
ans =
1 71
size(yi)
ans =
1 111
size(xxi)
ans =
111 71
size(yyi)
ans =
111 71
zzi=interp2(x,y,z,xxi,yyi,'cubic'); % Cubic interpolation − interpolates
% all combinations of xxi and yyi and constructs the matrix zzi
Numerical Analysis Using MATLAB® and Excel®, Third Edition 7−37
Copyright © Orchard Publications

