1
$\begingroup$

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$$

$\endgroup$
4
  • 4
    $\begingroup$ Look up ContourPlot3D[]. $\endgroup$ Aug 17, 2015 at 8:02
  • 5
    $\begingroup$ Possible duplicate: mathematica.stackexchange.com/questions/10710/…. 2D version: mathematica.stackexchange.com/questions/34668/… $\endgroup$
    – Michael E2
    Aug 17, 2015 at 10:04
  • $\begingroup$ 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. $\endgroup$
    – Michael E2
    Aug 17, 2015 at 10:09
  • 1
    $\begingroup$ @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. $\endgroup$
    – ubpdqn
    Aug 17, 2015 at 12:05

2 Answers 2

7
$\begingroup$

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

$\endgroup$
3
$\begingroup$

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

$\endgroup$
1
  • 5
    $\begingroup$ There's also a wonderful page in the documentation: Ellipsoid ;-) $\endgroup$
    – Michael E2
    Aug 17, 2015 at 13:57

Not the answer you're looking for? Browse other questions tagged or ask your own question.