
How would I go about plotting an ellipse?
3 views (last 30 days)
Show older comments
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?
0 Comments
Accepted Answer
Star Strider
on 6 Feb 2018
Another approach using https://www.mathworks.com/help/matlab/ref/isosurface.html*|isosurface|* (link):
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')

0 Comments
More Answers (1)
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
0 Comments
See Also
Categories
Find more on 2-D and 3-D Plots 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!