MATLAB: How to turn vertical to horizontal 3d plots >>[X,Y,~]=sphere(21); >>s=sin(0:2*pi/21:2*pi); >>Z=repmat(s',1,22); >>figure(12); >>subplot(1,2,1); >>surf(X,Y,Z); >>alpha(0.5); >>xlabel('x');ylabel('y');zlabel('z'); Best Answer Something like this[X,Y,~]=sphere(21);s=sin(0:2*pi/21:2*pi);Z=repmat(s',1,22);figure(12);subplot(1,2,1);surf(X,Y,Z);alpha(0.5);xlabel('x');ylabel('y');zlabel('z');pbaspect([1 1 1])subplot(1,2,2);surf(Z,Y,X);alpha(0.5);xlabel('x');ylabel('y');zlabel('z');pbaspect([1 1 1]) Related SolutionsMATLAB: How plot to matrices in 3D Some possible options:x=1:5;y=3:5;[X, Y] = meshgrid(x, y)z = [-1 2 3; -5 -1 3; -2 4 8; 1 3 7; 4 7 10]subplot(2, 1, 1);surf(X, Y, z')xlabel('x', 'FontSize', 12);ylabel('y', 'FontSize', 12);zlabel('z', 'FontSize', 12);subplot(2, 1, 2);bar3(z')xlabel('x', 'FontSize', 12);ylabel('y', 'FontSize', 12);zlabel('z', 'FontSize', 12); MATLAB: How to change the radius of the spiral so it varies along the length from 0 to 1 Change āxā and āzā to: x=cos(y/100*10*pi).*(y/100);z=sin(y/100*10*pi).*(y/100);so the full code siis now: y=0:0.5:100; n=length(y); x=cos(y/100*10*pi).*(y/100);z=sin(y/100*10*pi).*(y/100); X=[zeros(1,n);x]; Y=[y;y]; Z=[zeros(1,n);z]; surf(X,Y,Z); alpha(0.5); view(75,15). Related QuestionSUBPLOT : UPPER & LOWER PLOTHow to plot graph scaleHow to plot x^2+z^2=9 above the xy plane and between y=-1 and y=2I get error saying that z should be a matrix and not a scalar
Best Answer