1
$\begingroup$

In this animation, I want to show each component of velocity (V_x, V_y and V_z) with arrows in the respective direction that should change dynamically i.e the length of the arrows should represent the magnitude of their vectors.

Animate[ParametricPlot3D[{Cos[t], Sin[t], t/10}, {t, 0, u}, 
   Mesh -> {{u}}, MeshStyle -> Red, 
   Method -> {"BoundaryOffset" -> False}, 
   AxesLabel -> {"X", "Y", "Z"}, 
   PlotTheme -> {"Scientific", "BoldColor"}, 
   PlotRange -> {{-2, 2}, {-2, 2}, {0, 8}}] /. 
  Point -> (Sphere[#, .18] &), {u, 10^-6, 30}, AnimationRate -> 0.05]

enter image description here

$\endgroup$

2 Answers 2

4
$\begingroup$
  • For a velocity vector v={a,b,c}, we use {a,b,c}.IdentityMatrix[3] to get it's components vx={a,0,0},vy= {0,b,0},vz= {0,0,c}.

  • The vz={0,0,1/10} looks too small.

Clear[f, v, frame];
f[t_] = {Cos[t], Sin[t], t/10};
v[t_] = f'[t];
frame[t_] = v[t]*IdentityMatrix[3];
Animate[Show[
  ParametricPlot3D[{Cos[t], Sin[t], t/10}, {t, 0, u}, 
   AxesLabel -> {"X", "Y", "Z"}, 
   PlotTheme -> {"Scientific", "BoldColor"}, 
   PlotRange -> {{-2, 2}, {-2, 2}, {0, 8}}], 
  Graphics3D[{Arrowheads[.01], 
    Thread@{{Green, Orange, Red}, 
      Arrow[{f[u], f[u] + #}] & /@ frame[u]}}]], {u, 10^-6, 30}, 
 AnimationRate -> 0.05]
Simplify[Sqrt[v[t] . v[t]], Assumptions -> t ∈ Reals]

Sqrt[101]/10

So the norm of the velocity is a constant.

enter image description here

$\endgroup$
5
  • $\begingroup$ Thank you @cvgmt . Your code paved the path for my desired answer. What should I do now to get Y components always parallel to the x and y axes and what should I do for the Z component? f[t_] = {Cos[t], Sin[t], t/10}; v[t_] = f'[t]; Animate[Show[ParametricPlot3D[{Cos[t], Sin[t], t/10}, {t, 0, u},AxesLabel -> {"X", "Y", "Z"}, PlotTheme -> {"Scientific", "BoldColor"},PlotRange -> {{-2, 2}, {-2, 2}, {0, 8}}],Graphics3D[{Red, Arrow[{f[u], f[u] + v[u][[1]]}], Darker[Green], Arrow[{f[u], f[u] + v[u][[2]]}]}]], {u, 10^-6, 30}, AnimationRate -> 0.05] $\endgroup$
    – user444
    Sep 16, 2022 at 7:02
  • $\begingroup$ Thank you for the edit. Just one more thing. How can I Scale the arrows? For my original equations, one of the arrows is touching 600 on y axis. I want to scale it show that it falls in a visible region of the plot $\endgroup$
    – user444
    Sep 16, 2022 at 11:40
  • $\begingroup$ @user84456 Maybe add scaling factor at v[t] or control Arrowheads. $\endgroup$
    – cvgmt
    Sep 16, 2022 at 12:09
  • $\begingroup$ DiagonalMatrix[{a, b, c}] $\endgroup$
    – cvgmt
    Sep 17, 2022 at 7:34
  • $\begingroup$ What is this? Could you please elaborate a little? $\endgroup$
    – user444
    Sep 17, 2022 at 12:27
2
$\begingroup$

If I understand you right. You can adjust the scale and the arrow type as needed.

enter image description here

Manipulate[
 Module[{p1, p2, xa, ya, za, scale = 2},
  p1 = ParametricPlot3D[{Cos[t], Sin[t], t/10}, {t, 0, u},
     Mesh -> {{u}}, MeshStyle -> Red,
     Method -> {"BoundaryOffset" -> False},
     AxesLabel -> {"X", "Y", "Z"},
     PlotTheme -> {"Scientific", "BoldColor"},
     PlotRange -> {{-2, 2}, {-2, 2}, {0, 8}}, ImageSize -> 500] /. 
    Point -> (Sphere[#, .1] &);
  xa = {{Red, Arrowheads[Small], 
     Arrow[{{Cos[u], Sin[u], u/10}, {scale*Cos[u], Sin[u], u/10}}]}, 
    Text["x", {scale*Cos[u], Sin[u], u/10}, {1, 0}]};
  ya = {{Red, Arrowheads[Small], 
     Arrow[{{Cos[u], Sin[u], u/10}, {Cos[u], scale*Sin[u], u/10}}]}, 
    Text["y", {Cos[u], scale*Sin[u], u/10}, {1, 0}]};
  za = {{Red, Arrowheads[Small], 
     Arrow[{{Cos[u], Sin[u], u/10}, {Cos[u], Sin[u], scale*u/10}}]}, 
    Text["z", {Cos[u], Sin[u], scale*u/10}, {1, 0}]};
  p2 = Graphics3D[{xa, ya, za}];
  Show[p1, p2]
  ],
 {{u, 1, "u"}, 10.^(-6), 100, .001, Appearance -> "Labeled"},
 TrackedSymbols :> {u}
 
 ]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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