How to move a (x,y) line plot to the z axis?
조회 수: 14(최근 30일)
I have recently got matlab and have been trying to use it to plot some functions. So far, i have been using plot(x,[y0,y1,y2....]) to plot several functions in one 2D plot, how can i move the y lines along the z axis to give a 3d view instead of them overlapping, with spacing long z, (0:7.5:60). So y0 would be at z=0, y1 at z=7.5, y2 at z=15. If the spacing can be filled in aswell to look like a smooth plain. If that makes any sense any help would be welcome. Thank you.
Matt Tearle 2014년 10월 22일
편집: Matt Tearle 2014년 10월 22일
Something like this, perhaps?
x = linspace(0,1)';
y1 = cos(2*pi*x);
y2 = x.^2;
y3 = y1.*y2;
The "z" values (actually x in MATLAB's world!) are 1, 2, 3,... instead of 0, 7.5, 15,... but that can be faked, if you really need:
ax = gca;
n = (1:3)'; % change the 3 to however many y variables there are
ax.XTick = n;
ax.XTickLabel = num2str(7.5*(n-1));