1

I need a way to plot a generic ellipsoid given the following implicit equation. Can someone help me?

$$\frac{x^2}{a^2}+\frac{y^2}{b^2}+\frac{z^2}{c^2}=1$$

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
Andrea Leo
  • 13
  • 1
  • 3
  • 4
    Look up ContourPlot3D[]. – J. M.'s missing motivation Aug 17 '15 at 08:02
  • 5
    Possible duplicate: http://mathematica.stackexchange.com/questions/10710/how-do-i-plot-x2y2-1-in-3d. 2D version: http://mathematica.stackexchange.com/questions/34668/how-can-i-plot-implicit-equations – Michael E2 Aug 17 '15 at 10:04
  • Is the problem plotting a surface defined by an equation, or is it something else, such as what to do about the literal constants, a, b, c? Please clarify. – Michael E2 Aug 17 '15 at 10:09
  • 1
    @AndreaLeo if your question relates how to plot this using Mathematica, there are a number of ways and some useful suggestions and links have been provided. This site is very willing to help if you have difficulties with your attempts beyond just requesting "how do you...?" I will post some options as answer but in future please try for yourself. You will have fun, learn things and if you get stuck people will be willing and able to assist. – ubpdqn Aug 17 '15 at 12:05

2 Answers2

7

See my general comment. Note Ellipsoid is a built-in function.

Here are some ways you could do this:

e[a_, b_, c_] := 
 ContourPlot3D[
  x^2/a^2 + y^2/b^2 + z^2/c^2, {x, -1.1 a, 1.1 a}, {y, -1.1 b, 
   1.1 b}, {z, -1.1 c, 1.1 c}, Contours -> {1}, 
  BoxRatios -> Automatic, Mesh -> False, Boxed -> False, 
  Background -> Black, Axes -> False]
p[a_, b_, c_] := 
 ParametricPlot3D[{a Sin[u] Cos[v], b Sin[u] Sin[v], c Cos[u]}, {u, 0,
    Pi}, {v, 0, 2 Pi}, Mesh -> False, Background -> Black, 
  Boxed -> False, Axes -> False]
s[a_, b_, c_] := 
 Graphics3D[
  GeometricTransformation[Sphere[], ScalingTransform[{a, b, c}]], 
  Background -> Black, Boxed -> False, Axes -> False]
el[a_, b_, c_] := 
 Graphics3D[Ellipsoid[{0, 0, 0}, {a, b, c}], Background -> Black, 
  Boxed -> False, Axes -> False]

Showing:

Manipulate[
 Grid[{{e[a, b, c], p[a, b, c]}, {s[a, b, c], el[a, b, c]}}], {a, 1, 
  5}, {b, 1, 5}, {c, 1, 5}]

enter image description here

ubpdqn
  • 60,617
  • 3
  • 59
  • 148
3

There is a wonderful page on Wolfram MathWorld: Ellipsoid where you can also download a NB.

There are two good friends; ContourPlot3D and RegionPlot3D;

a = 3; b = 2; c = 1;
ContourPlot3D[x^2/a^2 + y^2/b^2 + z^2/c^2 == 1, {x, -3, 3}, {y, -3, 3}, {z, -3, 3}]

enter image description here

With[{a = 3, b = 2, c = 1},
 RegionPlot3D[
  x^2/a^2 + y^2/b^2 + z^2/c^2 < 1, {x, -3, 3}, {y, -2, 2}, {z, -1, 1},
   BoxRatios -> Automatic]
 ]

enter image description here

xyz
  • 605
  • 4
  • 38
  • 117