I was recently studying about Longitudinal Waves and I have a little trouble understanding the Displacement versus distance graph for these waves. Firstly, how exactly does one come up with such a graph? I understand about compressions and rarefactions but I don't know how exactly to plot a graph between the displacement of the particles and the distance travelled by the wave. Moreover, why is that these graphs look identical for both transverse and longitudinal waves? I reckon that this is because the individual particles are undergoing simple harmonic motion, but I'm still missing some connection. Please help.