Vibration of a mass-spring-damper system

Beijing Institute of Technology | Ming-Jian Li

The following MATLAB code is a companion code for the course on Artificial Intelligence and Simulation Science. It functions to calculate the vibration of a mass point under the action of spring force, external excitation, and damping, with time integration performed using the forward Euler method.

The result is as follows. With different input parameters, the vibration differs a lot.