Matlab simulation of N beads connected by N-1 Hookean springs