I'm trying to make an animation of a time-varying 2D vector field. However, I'm got a difficulty in that Mathematica normalises the length of the vectors with each call to VectorPlot.
A (very simple) example:
myField = {Cos[2 π t], 0};
Animate[
VectorPlot[myField /. t -> TT, {x, -1, 1}, {y, -1, 1}],
{TT, 0, 1}]
Expected result: The arrows grow and shrink in time
The actual result: The arrows remain the same size, but flick direction
Is there some way to fix the length of the arrows relative to the field value?
Answer
As @Ox4A4D mentioned in the comment, you could use the option VectorScale to set the length of vectors, here is an example code:
myField = {Cos[2 \[Pi] t], 0};
Animate[VectorPlot[myField /. t -> TT, {x, -1, 1}, {y, -1, 1},
VectorScale -> Abs[0.05 Cos[2 Pi TT]]], {TT, 0, 1}]
Comments
Post a Comment