Message Boards Message Boards

Animate a Vectorfield with VectorPlot3d , Scaling the Vectors

Posted 10 years ago

Hey there,

i want to animate the Variation of a Vectorfield by controlling the Parameter m.

So far this is what i got and it works

 f[x_, y_, z_, g_, m_,v_] := 
   {((x)^2 - m), x*y,x*z}*(g*v^2)/
     (2*(g^2*((x)^2 - m)^2 + (v*y)^2 + (v*z)^2)^(3/2));   
plots = 
  Table[
    Show[
      VectorPlot3D[
        f[x, y, z, 1, e, 1], {x, -5, 5}, {y, -5, 5}, {z, -5, 5}, 
        VectorColorFunction -> Hue]], 
    {e, -5, 5, 1}];
ListAnimate[plots];
Export["Test.gif", plots, ImageResolution -> 200]

The problem is the scaling of the Vectors. Mathematica scales them in each frame. You cannot compare 2 picture directly because the size is at a different scaling.

I want the size of the vectors, in every frame, relative to e.g. the biggest possible vector in the whole animation. I used VectorScale-> but could not get it right.

Thank you for your Help and kind regards, max

POSTED BY: Max E
3 Replies

In Documentation Center is written:

With the vector scaling function set to None, then all vectors have the same size.

Animate[VectorPlot3D[
 f[x, y, z, 1, m, 1], {x, -5, 5}, {y, -5, 5}, {z, -5, 5}, 
 VectorColorFunction -> Hue, PlotRange -> 5, 
 VectorScale -> {Small, Automatic, None}], {m, -5, 5, 0.5}, 
AnimationRunning -> False]

or

Animate[VectorPlot3D[
  f[x, y, z, 1, m, 1], {x, -5, 5}, {y, -5, 5}, {z, -5, 5}, 
  VectorColorFunction -> Hue, PlotRange -> 5, 
  VectorScale -> {Small, Small, None}], {m, -5, 5, 0.5}, 
 AnimationRunning -> False]

I hope it will help.

POSTED BY: Mariusz Iwaniuk
Posted 10 years ago

This does not solve the Problem. The Problem is the different size of the vectors in each Frame.

But thank you for replying and trying to solve my problem ! Best regards, max

POSTED BY: Max E

If you have a problem with scaling you must add "Plot range".

f[x_, y_, z_, g_, m_, v_] :=
 {((x)^2 - m), x*y, x*z}*(g*v^2)/(2*(g^2*((x)^2 - m)^2 + (v*y)^2 + (v*z)^2)^(3/2));

 Animate[VectorPlot3D[f[x, y, z, 1, m, 1], {x, -5, 5}, {y, -5, 5}, {z, -5, 5},VectorColorFunction -> Hue, PlotRange -> 5], {m, -5, 5, 1},AnimationRunning -> False]

Export to Animation.

ANIM = Table[
   VectorPlot3D[
    f[x, y, z, 1, m, 1], {x, -5, 5}, {y, -5, 5}, {z, -5, 5}, 
    VectorColorFunction -> Hue, PlotRange -> 5], {m, -5, 5, 0.25}];
Export["Test.gif", ANIM, ImageResolution -> 200]
POSTED BY: Mariusz Iwaniuk
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract