For the contour graph, you really need either a matrix of z values ββor a set (vector) of z values ββevaluated on a grid. You cannot define contours using isolated Z values ββat points (X, Y) on the grid (that is, as you say you have).
You need the generation process (or function) to provide values ββfor the grid of points (x, y).
If not, you can create a surface from uneven data , as @nate pointed out correctly, and then draw outlines on that surface.
Consider the following (random) example:
N = 64; % point set x = -2 + 4*rand(N,1); % random x vector in[-2,2] y = -2 + 4*rand(N,1); % random y vector in[-2,2] % analytic function, or z-vector z = x.*exp(-x.^2-y.^2); % construct the interpolant function F = TriScatteredInterp(x,y,z); t = -2:.25:2; % sample uniformly the surface for matrices (qx, qy, qz) [qx, qy] = meshgrid(t, t); qz = F(qx, qy); contour(qx, qy, qz); hold on; plot(x,y,'bo'); hold off
The circles correspond to the initial vector points with values (x,y,z) for each point, by the contours on the contours of the interpolation surface. 

source share