Work

Automating the Derivation of Equations for 1D Mass-Spring-Damper Models in Matlab

Year: 2025
Type: conference-paper
Abstract: It is common to spend considerable time writing and implementing equations for 1D mass-spring-damper dynamics models when teaching the simulation of system dynamics using MATLAB ode solvers. These models typically involve masses, springs, and dashpots. In this paper, the authors present a systematic symbolic calculus approach to automate the process of deriving the necessary equations from the model and first principles. This approach utilizes a table, similar to the connectivity table used in finite element analysis. In this paper, the process is limited to 1D cases but can be used for complex systems by extending the symbolic definitions and equations accordingly. These equations are central to the time integration function, such as the ode45 function in MATLAB. This method streamlines the process of quickly writing and testing different models, reducing frustration caused by minor typographical errors that often arise. First, a basic 1D dynamics model is defined using a simple example. Next, a straightforward MATLAB symbolic code that automatically generates the equations for the subroutine called by the Ordinary Differential Equations (ODE) solver is introduced. Finally, the system's response over time is obtained, including the positions and velocities of the system for the given initial conditions.
Language: English
Open Access status: green
OpenAlex ID: W6949575571
FWCI:
Cites:
Cited by:
Related to: