Group Abstract Group Abstract

Message Boards Message Boards

0
|
3.9K Views
|
5 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Create logarithmically scaled arrows for vector plots?

Posted 5 years ago

I want to plot the following vector field in 2D, using the built in function VectorPlot: enter image description here Because the variation in modulus is typically several orders of magnitude, Mathematica's arrows are quite large near the source point, the point enter image description here, and are very short at the edge of the plot.

The way to solve this issue is to have the arrow lengths scaled logarithmically.

How can one do that in Mathematica? I came across the VectorScale option, and saw it accepts 3 arguments:

{unitlen,aratio,sfun}

As stated in the Documentation,

sfun is a scaling function that determines the width of vector boxes.

I think that the argument that is in interest for my purpose is sfun. But I need some help with writing down a command to be given there. Any help about it would be very appreciated.

POSTED BY: Ehud Behar
5 Replies
Posted 5 years ago
POSTED BY: Ehud Behar

VectorScale is an option to VectorPlot that you can add freely:

arctanElField[pt_, source_] := 
  ArcTan[1/Norm[pt - source]^2]*Normalize[pt - source];
Manipulate[
 VectorPlot[arctanElField[{x, y}, {0, 0}],
  Element[{x, y}, Annulus[{0, 0}, {1, 4}]],
  VectorScale -> s],
 {{s, .05}, 0.001, .5}]
POSTED BY: Gianluca Gorni
Posted 5 years ago
POSTED BY: Ehud Behar

Version 12.1 will start with a different default setting, which will greatly improve the default look of vector plots. The solution of Gianluca will suffice for now.

POSTED BY: Sander Huisman

Log may be too flattening. I would suggest to use ArcTan:

arctanElField[pt_, source_] := 
  ArcTan[1/Norm[pt - source]^2] Normalize[pt - source];
VectorPlot[arctanElField[{x, y}, {0, 0}], 
 Element[{x, y}, Annulus[{0, 0}, {1, 4}]]]
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard