Wave Reflection Explained...
A pulse traveling down a string and reflected from a fixed end will be reversed (up to down), but reflected from a free end it will stay up.
This can be understood by imagining a string twice as long, of the same thickness and tension, with equal pulses having opposite velocities coming in from the two ends to pass through each other in the middle. As an up pulse passes through a down pulse, the middle of the long string never moves – so the left-hand half of the string, which satisfies the same identical equation of motion as the string with the fixed end, and has the same “boundary condition” of never moving at the center point, behaves in exactly the same way.
A similar argument works for the free end string.
Code by Casey Bowler