given two sets of y and z values, plot a surface plot in matlab

Assuming you have two vectors y and z containing the values for the two variables,

main.m
% define y and z vectors
y = [...];
z = [...];

% create grid of y and z values
[Y, Z] = meshgrid(y, z);

% compute X values (arbitrary function used as example)
X = Y.^2 + Z.^2;

% plot surface
surf(Y, Z, X);
210 chars
13 lines

This will create a surface plot with y and z on the axes and the computed X values defining the height of the surface.

related categories

gistlibby LogSnag