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$
  • $\begingroup$ Could use If[] in Table[] to eliminate the singular points at the outset. $\endgroup$ – J. M. is away Oct 15 '18 at 9:09
  • $\begingroup$ Thanks but how? If[x==y==0, ?, ?] $\endgroup$ – MementoMori Oct 15 '18 at 9:16
  • 1
    $\begingroup$ Yes, like that. Table[If[x == y == 0, {0, 0}, (* stuff *)], (* stuff *)]. $\endgroup$ – J. M. is away Oct 15 '18 at 9:23
1
$\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$
0
$\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$
0
$\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, privacy policy and cookie policy

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