How can I plot two 2D figures simultaneously, with one orthogonal to the other? They both share the same t axis, but the x axis lies perpendicular to the z axis and t axis, and they all share the same zero point.

t = 0:.1:20;
x = 2*(18./(.5*t+.5).^.5 - 5.5);
z = 18./(.5*t+.5).^.5 - 5.5;
figure(1)
plot(t,x,':')
xlabel('Time')
ylabel('Distance')
set(gcf,'color','w')
figure(2)
plot(t,z,':')
xlabel('Time')
ylabel('Sink Rate')
set(gcf,'color','w')
axis([-inf inf -20 20])

 Accepted Answer

Do you mean you want a 3D axis?
t = 0:.1:20;
x = 2*(18./(.5*t+.5).^.5 - 5.5);
z = 18./(.5*t+.5).^.5 - 5.5;
figure;
plot3(t, x, zeros(size(t)));
hold on
plot3(t, zeros(size(t)), z);
xlabel('Time');
ylabel('Distance');
zlabel('Sink Rate');
grid on;
set(gca, 'ydir', 'reverse');

2 Comments

I'd like the graph to look similar to what is shown in the attached file
Using the view(az,el) I rotated your solution to what I needed. Thanks very much Kelly!

Sign in to comment.

More Answers (0)

Categories

Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!