How to plot position and/with velocity?

118 Views Asked by At

How to plot position and velocity?

Particularly, I've solved the mass-spring model using RK4.

Now I have lists of position and velocity values. But how am I to plot the "simulation"?

Is it enough to plot only $(t,x)$? I.e. ignore the velocity?


So the values I got were very small in magnitude, but I know they're correct. So at first I tried plotting $(t,10*x)$ and I see the motion, it just "goes right in $x$", rather than stays in place.

3

There are 3 best solutions below

0
On

i suggest plotting the results as points $(x(t),v(t))$ where $x(t)$ is the position at time $t$ and $v(t)$ is the velocity at time $t$. The result should be ... elegant. See also phase spaces, mass-spring system.

6
On

It's really up to you. What would you like to see? The evolution of the velocity in time? Then plot $(t, v(t))$. Or the evolution of the position? Then plot $(t, x(t))$.

1
On

You can make one graph with position vs. time and another with velocity vs. time. Sometimes they are plotted in the same frame with the velocity scale on the right. This helps see how the velocity is related to the position. It is confusing to use the same scale as the units are different.

For a system like this, it can also be useful to plot the potential and kinetic energies with respect to time. These can go on the same graph as the units are the same.