How Can I Plot This Contoured Function?

  • Thread starter Thread starter rsq_a
  • Start date Start date
  • Tags Tags
    Function Plots
Click For Summary
SUMMARY

The discussion focuses on plotting the function f(x,y) = 1/(xy) using Maple or MATLAB, specifically for generating contour plots. It is established that the function should be interpreted in cylindrical coordinates for accurate representation, using the transformation r = sqrt(x^2 + y^2). The suggested approach involves using z = -1/r for plotting, with variations like z = -1/r^2 and z = -1/(x^2 + y^2) also yielding similar contour shapes. The provided MATLAB code snippet demonstrates how to create a surface plot using meshgrid.

PREREQUISITES
  • Understanding of cylindrical coordinates in mathematics
  • Familiarity with MATLAB syntax and functions
  • Knowledge of contour plotting techniques
  • Basic grasp of 3D graphing concepts
NEXT STEPS
  • Learn how to implement cylindrical coordinates in MATLAB for 3D plotting
  • Explore advanced contour plotting techniques in MATLAB
  • Investigate the differences between surface plots and contour plots
  • Study the implications of varying functions like z = -1/r^2 and z = -1/(x^2 + y^2) in contour generation
USEFUL FOR

Mathematicians, data scientists, and engineers interested in 3D plotting and contour visualization using MATLAB or Maple.

rsq_a
Messages
103
Reaction score
1
This is both a question about the function used to plot AND how to plot the function (I'm interested in keeping the contour/level lines the same):

This looks like a simple f(x,y) = 1/(xy) function. But how would I get Maple/Matlab to plot the contours as shown?

http://science.nasa.gov/headlines/y2005/images/gpb/vortex1_crop.jpg one I have no idea. Any idea how its plot can be generated?
 
Last edited by a moderator:
Physics news on Phys.org
I don't see any great difference between the two.

First, they are 3 dimensional and, second, they have circular symmetry so it is best to use cylindrical coordinates. The first is not "1/xy" but you are right to think it looks like 1/x, rotated around the z-axis. Use "r", not x. z= -1/r will give a graph like that. Without more specific information about the graph, z= -1/r2, z= -1/r3, etc. all look the same. If you want them in Cartesian coordinates, use [itex]r= \sqrt{x^2+ y^2}[/itex]. Then they are [itex]z= -1/\sqrt{x^2+ y^2}[/itex], [itex]z= -1/(x^2+ y^2)[/itex], [itex]z= -1/(x^2+ y^2)^{3/2}[/itex], etc.l
 
try this:

[X,Y] = meshgrid([-5:0.2:5]);
Zm=1./sqrt(X.^2+Y.^2);
surf(X,Y,-Zm);
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 1 ·
Replies
1
Views
9K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 3 ·
Replies
3
Views
8K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K