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

Draw a 3D surface

7 views
Skip to first unread message

jl_0...@yahoo.com

unread,
Jun 10, 2009, 8:36:10 PM6/10/09
to
I intend to draw a 3D surface, which is defined in a tricky way. Given
function f(x, y), the values of f are known but the range is
determined by a function of y, g(y). I need to plot x as a function of
y and f within the range determined by g(y). Can anybody help?
Appreciate!

Jun Lin

Alexei Boulbitch

unread,
Jun 11, 2009, 7:06:35 AM6/11/09
to

Jun Lin

Hi, Jun,
I do not really understand, what do you mean with range determined with g(y). You should probably explain it in more details.

Concerning the first part of your question, here is the most simple answer: draw the f=f(x,y)surface using say, Plot3D,
and then rotate the graph with the mouse such that the Ox axis is directed upwards. ?? Or rotate it programmatically using
Rotate function.

If you need it upwards at once (this may be useful for example, if you need to programmatically include some other
graphics together with this plot), the following may help:

ParametricPlot3D[{y, Sin[x*y], x}, {x, -1, 1}, {y, -1, 1}, AxesLabel -> {"y", "f", "x"}]

I took here the function f=sin(xy) to be concrete.

Have success, Alexei

--
Alexei Boulbitch, Dr., habil.
Senior Scientist

IEE S.A.
ZAE Weiergewan
11, rue Edmond Reuter
L-5326 Contern
Luxembourg

Phone: +352 2454 2566
Fax: +352 2454 3566

Website: www.iee.lu

This e-mail may contain trade secrets or privileged, undisclosed or otherwise confidential information. If you are not the intended recipient and have received this e-mail in error, you are hereby notified that any review, copying or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal from your system. Thank you for your co-operation.

Jens-Peer Kuska

unread,
Jun 11, 2009, 7:08:14 AM6/11/09
to
Hi,

g[y_] := y^2 - 2

Plot3D[Exp[-x^2 - y^2], {x, -3, 3}, {y, -3, 3}, PlotRange -> All,
RegionFunction -> Function[{x, y, z}, x < g[y]]]


?

Regards
Jens

Syd Geraghty

unread,
Jun 12, 2009, 5:45:31 AM6/12/09
to
Hi,

This is a question inspired by Jens's use of RegionFunction below.

In the documentation for RegionFunction there is an example where
RegionFunction isa pure function is called with a slot number:

SphericalPlot3D[1 + Sin[5 =CE=B8] Sin[5 =CF=86]/5, {=CE=B8, 0, Pi}, {=CF=86, 0, 2 Pi},
Mesh -> None, RegionFunction -> (#6 > 0.95 &),
PlotStyle -> FaceForm[Orange, Yellow]]

Here I was perplexed to know what #6 was (and still cannot figure it
out).

How do I get to see what #6 is?

I then tried different values for the slot number:

{SphericalPlot3D[1 + Sin[5 =CE=B8] Sin[5 =CF=86]/5, {=CE=B8, 0, Pi}, {=CF=86, 0, 2 Pi},
Mesh -> None, RegionFunction -> (#1 > 0.95 &),
PlotStyle -> FaceForm[Orange, Yellow]],
SphericalPlot3D[1 + Sin[5 =CE=B8] Sin[5 =CF=86]/5, {=CE=B8, 0, Pi}, {=CF=86, 0, 2 Pi},
Mesh -> None, RegionFunction -> (#2 > 0.95 &),
PlotStyle -> FaceForm[Orange, Yellow]],
SphericalPlot3D[1 + Sin[5 =CE=B8] Sin[5 =CF=86]/5, {=CE=B8, 0, Pi}, {=CF=86, 0, 2 Pi},
Mesh -> None, RegionFunction -> (#3 > 0.95 &),
PlotStyle -> FaceForm[Orange, Yellow]],
SphericalPlot3D[1 + Sin[5 =CE=B8] Sin[5 =CF=86]/5, {=CE=B8, 0, Pi}, {=CF=86, 0, 2 Pi},
Mesh -> None, RegionFunction -> (#4 > 0.95 &),
PlotStyle -> FaceForm[Orange, Yellow]],
SphericalPlot3D[1 + Sin[5 =CE=B8] Sin[5 =CF=86]/5, {=CE=B8, 0, Pi}, {=CF=86, 0, 2 Pi},
Mesh -> None, RegionFunction -> (#5 > 0.95 &),
PlotStyle -> FaceForm[Orange, Yellow]],
SphericalPlot3D[1 + Sin[5 =CE=B8] Sin[5 =CF=86]/5, {=CE=B8, 0, Pi}, {=CF=86, 0, 2 Pi},
Mesh -> None, RegionFunction -> (#6 > 0.95 &),
PlotStyle -> FaceForm[Orange, Yellow]]}

and the result was an interesting sequence of 3D objects (note that
there are only 6 slots valid - #7 fails)

As a further enquiry I tried a Table version of the above:

Table[SphericalPlot3D[1 + Sin[5 =CE=B8] Sin[5 =CF=86]/5, {=CE=B8, 0, Pi}, {=CF=86, 0, 2
Pi},
Mesh -> None, RegionFunction -> (# i > 0.95 &),
PlotStyle -> FaceForm[Orange, Yellow]], {i, 1, 6, 1}]

To my surprise the resulting 3D objects were different after #1.

I would appreciate any enlightenment here regarding slots and valid
Table increments for slots.

Thanks in advance .... Syd


Syd Geraghty B.Sc, M.Sc.

sydge...@mac.com

Mathematica 7.0.1 for Mac OS X x86 (64 - bit) (18th February 2009)
MacOS X V 10.5.6
MacBook Pro 2.33 GHz Intel Core 2 Duo 2GB RAM

On Jun 11, 2009, at 4:08 AM, Jens-Peer Kuska wrote:

> Hi,
>
> g[y_] := y^2 - 2
>
> Plot3D[Exp[-x^2 - y^2], {x, -3, 3}, {y, -3, 3}, PlotRange -> All,
> RegionFunction -> Function[{x, y, z}, x < g[y]]]
>
>
> ?
>
> Regards
> Jens
>
> jl_0...@yahoo.com wrote:

0 new messages