Applet shows an oscillating body. Initially the body is at the top extreme position. The amplitude and the frequency of oscillations can be adjusted using the scrollbars. The black vector is the force on the body due to the spring. A periodic force whose frequency and amplitude can be varied can be applied on the body. This force vector is shown in green color. A resistive force can also be made to act on the body. This is shown in red color. This force too can be varied by adjusting the damping coefficient slider.
The blue curve is the path of the oscillating body traced on a strip of paper moved uniformly below it. The green curve shows the variation of the periodic force and the red curve the variation of the damping force.
The vectors are not drawn to scale. Effect of gravity on the equilibrium position is ignored.