Confused about behaviour of spring mass system I am writing some code that will plot the behaviour of a system consisting of 4 springs and 3 masses. They are arranged in the configuration (s:spring, m:mass)
wall-s-m-s-m-s-m-s-wall

I have set the masses to have the same mass and the springs to have the same spring constant.
I notice that if I give each mass an equal initial displacement (say, of 1.5), I will get a graph like this:

However, if I displace only the first spring I get a graph like this (x is displacement, q is velocity):

I had thought the resonance frequencies would be the same (same mass, same spring constant), so the graph would show a sinusoidal curve. However, the graph appears to be 'messy', and I am not sure how to explain this behaviour. Why is the displacement irregular? 
 A: What you are seeing are "harmonics."  Its the sum of multiple sine waves.
When you handle a "simple" case, the system operates in one "mode," with a single harmonic.  If you displace it differently, you may see multiples of this fundamental harmonic together.
Indeed, guitarists rely on this to change the tone of their music.  If they pluck the string closer to the neck of the guitar, they pull the string into a shape which closely resembles the fundamental harmonic of the string before letting it go.  This causes most of the energy (and thus sound) to be found in that fundamental.  If they pluck closer to the bridge, the shape has a very short side (the side between your finger and the bridge), which leads to lots of high overtones dominating the sound.
A: To me, the first graphs are confusing. Frankly I suspect there is some
fault in your code.
I see all three masses moving the same. But if you give them equal
initial displacements the springs #2 and #3 aren't initially deformed.
How can mass #2 start moving exactly as the others do?
To be sure, your system can be exactly solved analytically. Are you able to do it?
A suggestion. Try your code with just one mass, then with two. What do
you expect? What does your simulation say?
