2
$\begingroup$

i'm trying to draw an irrotational vortex with this function:

ListVectorPlot[Table[{-y/(x^2 + y^2), x/(x^2 + y^2)}, {x, -3, 3, 3}, {y, -3, 3, 3}]]

But as you can see this function has a singularity in the origin, so how can i exclude a certain range of values close to the origin?

Thanks?

$\endgroup$
3
  • $\begingroup$ Could use If[] in Table[] to eliminate the singular points at the outset. $\endgroup$ Commented Oct 15, 2018 at 9:09
  • $\begingroup$ Thanks but how? If[x==y==0, ?, ?] $\endgroup$ Commented Oct 15, 2018 at 9:16
  • 1
    $\begingroup$ Yes, like that. Table[If[x == y == 0, {0, 0}, (* stuff *)], (* stuff *)]. $\endgroup$ Commented Oct 15, 2018 at 9:23

3 Answers 3

2
$\begingroup$

A bit hacky, but you can do this:

Quiet[
 ListVectorPlot[
  Table[
   {-y/(x^2 + y^2), x/(x^2 + y^2)}, 
   {x, -3, 3, 1}, {y, -3, 3, 1}
   ] /. Indeterminate -> 0
  ]
 ]

enter image description here

$\endgroup$
1
$\begingroup$
ListVectorPlot[
Table[{y/(x^2+y^2+2),-x/(x^2+y^2+2)},{x,-3,3,0.3},{y,-3,3,0.3}],PlotTheme -> "Minimal"]   

enter image description here

$\endgroup$
1
$\begingroup$

You can pre-specify the points you wish to plot. Here's one way of doing so using CirclePoints, which allows you to easily specify a minimum radius:

With[{pts =
   Flatten[Table[CirclePoints[n/2, 4*n + 1], {n, 1, 6}], 1]},
 ListVectorPlot[
  N@Map[Replace[p : {x_, y_} :> {p, {-y, x}/(x^2 + y^2)}], pts]]]

vector plot

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.