How would I go about plotting an ellipse?

3 views (last 30 days)
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?

Accepted Answer

Star Strider
Star Strider on 6 Feb 2018
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')

More Answers (1)

Walter Roberson
Walter Roberson on 6 Feb 2018
syms x y z
eq = (x^2/9)+(y^2/16)+(z^2/9)==1;
fimplicit3(eq);
axis equal

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!