MATLAB: How to go about plotting an ellipse

plotting

So I have an ellipse (x^2/9)+(y^2/16)+(z^2/9)=1, how do I go about plotting the surface plot of this?

Best Answer

elpsfcn = @(x,y,z) (x.^2/9)+(y.^2/16)+(z.^2/9); %=1
v = linspace(-5, 5, 150);
[X,Y,Z] = meshgrid(v);
elps = elpsfcn(X,Y,Z);
figure(1)
p = patch(isosurface(X,Y,Z,elps, 1), 'FaceColor','interp');
vn = get(p, 'Vertices');
cmv = colormap(jet(size(vn,1)));
set(p, 'FaceColor','interp', 'EdgeColor','none', 'FaceVertexCData',cmv)
grid on
view(60, 25)
axis equal
xlabel('X')
ylabel('Y')
zlabel('Z')
Related Question