Plot 3D on Vertical Planes in Matlab


% Initializing the variables

t = 0 : pi/50 : 10*pi;

% Plot 1: 3D spring

subplot(1,3,1)
plot3(sin(t),cos(t),t);hold on; grid on; axis square

% Plot 2: x-y plane

z = ones(length(t),1);
subplot(1,3,2)
plot3(sin(t),cos(t),z*0,'k');hold on

% Plot 2: x-z plane

plot3(z,cos(t),t,'g')

% Plot 2: y-z plane
plot3(sin(t),z,t,'r'); grid on; axis square

Plot 3 

subplot(1,3,3)

plot3(sin(t),cos(t),t);hold on
grid on

% Plot 3: x-y plane
plot3(sin(t),cos(t),z*0,'k');hold on

% Plot 3: x-z plane
plot3(z,cos(t),t,'g')

% Plot 3: y-z plane
plot3(sin(t),z,t,'r')
axis square


No comments:

Post a Comment