To learn more about oscillatory motion which I am learning about in my high school physics class, I have created a computer model of a damped spring where the damping force is proportional to velocity. The graph of position vs time appears as expected, a sine wave with amplitude decaying over the course of time.
I was interested in seeing the curve encompassing the peaks of the graph (the green line in this image). To do so, I created a new column in Excel which calculated the total energy of the system using the values of position and velocity the computer program outputted, then expressed that energy as a displacement from equilibrium using x = sqrt(2E/k).
When I graphed the results, I expected to see a smooth curve. However, I instead saw strange curves in between each peak: .
I am somewhat unsure about the origin of these. Should the "total energy" curve (the red one; although this isn't truly the energy) flatten out at each point at which the velocity equals zero in the real world? Or was my assumption that damping force is proportional to velocity a faulty one? If the latter is true, what would be a more accurate method of representing the damping force?