Try this:
x = linspace(0, 2*pi, 50);
y = sin(x);
z = [ones(size(x)); zeros(size(x))];
figure(1)
surf([x; x], [y; y], z)
grid on
axis equal
Also, if you want more ‘levels’ in the z-direction:
x = linspace(0, 2*pi, 50);
y = sin(x);
z = [(1:-0.2:0)'*ones(size(x))];
figure(1)
surf(repmat(x,size(z,1),1), repmat(y,size(z,1),1), z)
grid on
axis equal
The ‘(1:-0.2:0)’ in the z calculation sets the number of ‘levels’ and values of the ‘levels’. Experiment with it to get the result you want.
NOTE — This requires x and y to be row vectors.
EDIT — Added plot image.
Best Answer