Message Boards Message Boards

0
|
3978 Views
|
8 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Struggling with Plot3D for a two function plot

Posted 9 years ago

Just not getting anywhere with this 2 function plot, plot 2 functions (plane and cylinder):

Plot3D[{x+3, x^2 + y^2 - 9}, {x, -5, 5}, {y, -5, 5}]

I don't get a cylinder?

And how do I show axes?

POSTED BY: Alan Smith
8 Replies
Posted 9 years ago

Thanks Marco, I had found AxesLabel in the documentation, couldn't get it to work - maybe because I didn't have LabelStyle - but this now goes into my 'cheatsheet' :-)

POSTED BY: Alan Smith
Posted 9 years ago

OK, this is good thanks. Interestingly it showed the 1st function as y=x+3, I needed z=x+3, got it working with

ContourPlot3D[{x + 3 - z == 0, x^2 + y^2 - 9 - z == 0}, {x, -5,   5}, {y, -5, 5}, {z, -1, 1}]

Is it a good idea to always use implicit functions?

Also I'd really like to label the axes?

POSTED BY: Alan Smith

The option for Labels is quite easy to find:

ContourPlot3D[{x + 3 - z == 0, x^2 + y^2 - 9 - z == 0}, {x, -5, 5}, {y, -5, 5}, {z, -1, 1}, 
 AxesLabel -> {"x-axis", "y-axis", "z-axis"}, 
 LabelStyle -> Directive[Bold, Medium, Red]]

Cheers, Marco

POSTED BY: Marco Thiel

Implict functions are more general than explict functions. Every explicit function such as z==x+3 can be rewritten as an implict function z-x-3==0. Not the converse: x=0 cannot be rewritten as an explict function. On the other hand, explicit functions are easier to understand. The algorithms for plotting implicit and explicit functions are different.

The choice depends on your particular needs.

POSTED BY: Gianluca Gorni
Posted 9 years ago

Thanks Gianluca, Could you show a simple example of the difference? I looked them up in documentation but nothing stood out; for example doc. shoiws:

ContourPlot[f,{x,Subscript[x, min],Subscript[x, max]},{y,Subscript[y, min],Subscript[y, max]}]

generates a contour plot of f as a function of x and y.

ContourPlot[f==g,{x,Subscript[x, min],Subscript[x, max]},{y,Subscript[y, min],Subscript[y, max]}]

plots contour lines for which f=g.

POSTED BY: Alan Smith

A semisphere done in two ways:

Plot3D[Sqrt[1 - (x^2 + y^2)], {x, -1, 1}, {y, -1, 1}]
ContourPlot3D[x^2 + y^2 + z^2 == 1, {x, -1, 1}, {y, -1, 1}, {z, 0, 1}]
POSTED BY: Gianluca Gorni

z=x+3 is a plane, but z=x^2 + y^2 - 9 is a paraboloid. You get a plane and a cylinder for example with

Plot3D[{x + 3, Sqrt[9 - x^2]}, {x, -5, 5}, {y, -5, 5}, 
 BoxRatios -> Automatic]
POSTED BY: Gianluca Gorni

Hi,

ContourPlot3D might help:

ContourPlot3D[{x + 3, x^2 + y^2 - 9}, {x, -5, 5}, {y, -5, 5}, {z, -1, 1}]

enter image description here. Note that I needed to add a range for the z-coordinate.

Cheers,

Marco

POSTED BY: Marco Thiel
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract