Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[mg4908] help!! Plot3D of ellipsoid

249 views
Skip to first unread message

Paul R. Wellin

unread,
Oct 7, 1996, 3:00:00 AM10/7/96
to

> I am trying to get a 3-d plot of an ellipsiod, of the equation
>
> (x^2/a^2) + (y^2/b^2) + (z^2/c^2) = 1
>
> manipulating the equation I can get
>
> z = (c^2 (1- (x^2/a^2) - (y^2/b^2)))^1/2
>
> then, with the constants defined, I write
>
> Plot3D[z,{x,0,a},{y,0,b}]
>
> Mathematica then spits out a bunch of errors

You will have to parametrize the surface. I'll leave the
details to you, but with a bit of work, you can parametrize
the ellipsoid as:

In[1]:=
ellipsoid[u_,v_] := {a Cos[u] Cos[v], b Sin[u] Cos[v], c Sin[v]}

Then you can generate your surface as:

In[2]:=
a = 1;
b = 1;
c = 2;
ParametricPlot3D[ellipsoid[u, v],
{u, 0, 2 Pi}, {v, -Pi/2, Pi/2}]

Out[2]= -Graphics3D-


You can fiddle with the parameters to get stretch the ellipse
in the x, y, or z directions.

---
Paul Wellin
Academic/Business Liaison
Wolfram Research, Inc.
100 Trade Center Drive
Champaign, IL 61820

phone: 217-398-0700
fax: 217-398-0747
email: wel...@wolfram.com


Keith S. Mersman

unread,
Oct 9, 1996, 3:00:00 AM10/9/96
to

On Fri, 4 Oct 1996, Seth wrote:

> I am trying to get a 3-d plot of an ellipsiod, of the equation
>
> (x^2/a^2) + (y^2/b^2) + (z^2/c^2) = 1
>
> manipulating the equation I can get
>
> z = (c^2 (1- (x^2/a^2) - (y^2/b^2)))^1/2
>
> then, with the constants defined, I write
>
> Plot3D[z,{x,0,a},{y,0,b}]
>
> Mathematica then spits out a bunch of errors
>
>
>

Seth,

The reason you're getting error messages is because your function z does
not have real values for the square {0,a}X{0,b}. It is only defined on an
elliptical region in that area. The syntax of Plot3D, however, designates
that it must be defined on a rectangular region. To get around this, you
can use modified spherical coordinates.
{xr_,[s_,t_],y[r_,s_,t_],z[r_,s_,t_]}={a r Sin[s] Cos[t], b r Sin[s]
Sin[t], c r Cos[s]}. Setting r equal to 1, you can verify that x^2/a^2 +
y^2/b^2 + z^2/c^2 = 1. Then you can use
ParametricPlot3D[{x[1,s,t],y[1,s,t],z[1,s,t]},{s,0,Pi},{t,0,2 Pi}]

to plot the ellipsoid.

======================================================
Keith S. Mersman
Mathematica Consultant,
University of Missouri-Columbia

Mailbox: 220 Math Science Building
Office: GCB 124A
Office Phone: (573) 884-6771
Office Hours:
Sunday--6:00-10:00 p.m.
Monday--7:00-11:00 p.m.
Tuesday--6:00-6:30 p.m. and 8:30 to 10:00 p.m.
Wednesday--6:00-10:00 p.m.
Thursday--6:00-6:30 p.m. and 8:30 to 10:00 p.m.

e-mail address:

mer...@everest.cclabs.missouri.edu

c62...@showme.missouri.edu

www address:

http://www.phlab.missouri.edu/~mersman
and
http://www.missouri.edu/~c621746
======================================================


Xah Lee

unread,
Oct 9, 1996, 3:00:00 AM10/9/96
to

Someone wrote:
>
> > I am trying to get a 3-d plot of an ellipsiod, of the equation
> >
> > (x^2/a^2) + (y^2/b^2) + (z^2/c^2) = 1
> >...

"Paul R. Wellin" <wel...@wolfram.com> wrote:
> You will have to parametrize the surface. I'll leave the

> details to you...

Whoever are interested:

You can also plot it using ContourPlot3D.m by Tom Wickerham Jones at
Wolfram. It is available on MathSource. (http://www.wolfram.com) Sorry I
don't have the file ID handy.


Xah
x...@best.com; 7463...@compuserve.com
http://www.best.com/~xah/SpecialPlaneCurves_dir/specialPlaneCurves.html
Mountain View, CA, USA


Andrei Constantinescu

unread,
Oct 9, 1996, 3:00:00 AM10/9/96
to

Hi Seth !

Note that the errors are corect as the ellipse in the x,y plane
does not completely fill the {x,0,a},{y,0,b} rectangle !

In order to get a nice Plot, try to find a nice Parametrization, and
try ParametricPlot3D !

a + andrei

0 new messages