clear all z=linspace(-1,1,40); theta=linspace(0,2*pi,40); [z,theta]=meshgrid(z,theta); r=6*sqrt((1-z.^2)./(5.*cos(theta).^2+4)); x=r.*cos(theta); y=r.*sin(theta); mesh(x,y,z) axis equal grid on box on view([130,30]) xlabel('x-axis') ylabel('y-axis') zlabel('z-axis') title('The graph of the ellipsoid x^2/4 + y^2/9 + z^2 =1')