I don't think that I am totally able to understand the crust of your question at this momenent. But what I can share quickly with you is how to do a contour plot z = f(x, y) in general
Let's say you have a vector x, y and z and x = [x1, x2.... xn]; y = [y1, y2, .... yn]; z=[z1, z2, .... zn]
%Now convert them into rectangular matrices using meshgrid, and grid data
xi=linspace(min(x),max(x), n); yi=linspace(min(y),max(y),n);
ZI = griddata(x,y,z,XI,YI);
Hope it helps!