Mathematica Asked by Babelfish on June 16, 2021
I’m trying to plot the following VectorField:
VectorPlot[{x/Sqrt[x^2 + y^2], y/Sqrt[x^2 + y^2]}, {x, -5, 5}, {y, -5, 5}]
I want to use a VectorScaling-option such that vectors are displayed accoring to their length. Obviously, all vectors in this specific vector plot should have the same length, as they are normalized.
I tried to achieve this using the options
VectorScaling->Automatic
This yields the following output:
The vectors have different lengths (and the colors match this). Why does this happen? The options "Linear", "Log" and "Sqrt" yield similar results. Is this an artifact of calculation inaccuracies? If so, how may I compensate for this?
If I don’t use any VectorScaling-option, then all the vectors have the same length (which is the default), but the colors still vary.
I’m using Wolfram Mathematica 12.3.
Addendum: I understand that getting rid of "VectorScaling->Automatic" would yield vectors of constant length. Though I’d like to plot three different vector fields in such a way, that the length of the plottet vectors relates to the real length. So I need some sort of vector scaling for this field of constant length, too.
f1[x_, y_] := x/Sqrt[x^2 + y^2];
f2[x_, y_] := y/Sqrt[x^2 + y^2];
p1 = VectorPlot[{f1[x, y], f2[x, y]}, {x, -5, 5}, {y, -5, 5},
VectorScale -> {Automatic, Automatic, #1 &}, ImageSize -> Medium]
p2 = VectorPlot[{f1[x, y], f2[x, y]}, {x, -5, 5}, {y, -5, 5},
VectorScale -> {Automatic, Automatic, #2 &}, ImageSize -> Medium]
Finally
Show[p1, p2]
Answered by Alrubaie on June 16, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP