Graph 2 3D figures in Matlab at the time

1

Hello! I have a problem. I have made 2 3D graphics in Matlab. The first is an ellipsoid:

syms x y z
[x,y]=meshgrid([-5:0.05:5],[-5:0.05:5]);
z1=(sqrt(-9*x.^2-y.^2+9))
z2=(-sqrt(-9*x.^2-y.^2+9))
plot3(x,y,z1,x,y,z2)
zlim([-4 1.5])

And the second one is a paraboloid of a leaf:

syms x y z
[x,y]=meshgrid([-5:0.05:5],[-5:0.05:5]);
z1=-sqrt(x.^2+y.^2-1)
z2=sqrt(x.^2+y.^2-1)
plot3(x,y,z1,x,y,z2)
zlim([1.5 4])

As you can see, each one is limited by the x axis. Even so, if you graph them at the time, using the hold on command, only the last limit is applied.

syms x y z
[x,y]=meshgrid([-5:0.05:5],[-5:0.05:5]);
z1=(sqrt(-9*x.^2-y.^2+9))
z2=(-sqrt(-9*x.^2-y.^2+9))
plot3(x,y,z1,x,y,z2)
zlim([-4 1.5])
hold on
syms x y z
[x,y]=meshgrid([-5:0.05:5],[-5:0.05:5]);
z1=-sqrt(x.^2+y.^2-1)
z2=sqrt(x.^2+y.^2-1)
plot3(x,y,z1,x,y,z2)
zlim([1.5 4])

The specific question is: How can I graph them at the same time and, moreover, each one keep those limits on the z axis, so that they look something like "united" or as if they were a single figure?

Thanks!

    
asked by Andrés 07.04.2017 в 04:01
source

0 answers