Message Boards Message Boards

0
|
2587 Views
|
2 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Plot a function in polar coordinates, not PolarPlot

Hello, How to plot a function [contours, or density] say in 2D, but that is expressed in polar coordinates (r and phi) and not cartesian coordinates which are taken automatically by the notebook? Example

f = r^2 Cos [phi], {r,-5,5}, {phi,0, 2 Pi}

When I do that, the notebook automatically assumes r and phi to be the cartesian coordinates x and y!

POSTED BY: Rabih Sultan
2 Replies

Thank you very much. That was quite helpful. Rabih

POSTED BY: Rabih Sultan

Hello Rabih Sultan,

one obvious way would be expressing r and phi in cartesian coordinates:

f[r_, phi_] := r^2 Cos[phi]
ContourPlot[f[Norm[{x, y}], ArcTan[x, y]], {x, -5, 5}, {y, -5, 5}, RegionFunction -> (Norm[{#1, #2}] < 5 &)]

enter image description here

POSTED BY: Henrik Schachner
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