I want to plot a 3d scatter plot with a surface plot on the same figure, so that I end up with something like this:
I would have thought that the code below might have achieved what I wanted but obviously not. I have x
, y
and z
data to plot a scatter3
:
x = [1 1 1 1 0.95 0.95 0.95 0.95 0.85 0.85 0.85 0.85 0.8 0.8 0.8 0.8 0.75 0.75 0.75 0.75]';
y = [0.3 0.2 0.15 0.1 0.3 0.2 0.15 0.1 0.3 0.2 0.15 0.1 0.3 0.2 0.15 0.1 0.3 0.2 0.15 0.1]';
z = [0.1 0.15 0.2 0.3 0.1 0.15 0.2 0.3 0.1 0.15 0.2 0.3 0.1 0.15 0.2 0.3 0.1 0.15 0.2 0.3]';
scatter3(x,y,z)
hold on
And now add a surface??
p = [x y z];
surf(p)
Any ideas? Thanks.