1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
% Determine the minimum and the maximum x and y values:
xmin = min(x1); ymin = min(y1);
xmax = max(x1); ymax = max(y1);
% Define the resolution of the grid:
xres=10;
yres=15;
% Define the range and spacing of the x- and y-coordinates,
% and then fit them into X and Y
xv = linspace(xmin, xmax, xres);
yv = linspace(ymin, ymax, yres);
[Xinterp,Yinterp] = meshgrid(xv,yv);
% Calculate Z in the X-Y interpolation space, which is an
% evenly spaced grid:
Zinterp = griddata(x1,y1,z1,Xinterp,Yinterp);
% Generate the contour plot :
figure(2)
contour(Xinterp,Yinterp,Zinterp)
xlabel('x(pixels)');ylabel('y(pixels)'); |
Partager