Multi-body dynamics is used to calculate the physical quantities required for component design, such as calculating the dynamic response of mechanical components and the time history of dynamic loads. Advances in analysis software, including DADS, ADAMS, RecurDyn, and DAFUL, have made it possible to easily calculate dynamic responses by defining relationships between components and operating environments from 3D modeling on user-created components. However, when the understating of dynamic analysis is lacking, it is difficult to apply multi-body dynamics analysis in the design process, and it is difficult to analyze the acquired response data. In this study, we developed an automatic code to derive equations of motion in the matrix format and calculate dynamic responses of multi-body systems using GNU Octave, a free high level language. In particular, the process of defining matrices and vectors such as inertia matrix, stiffness matrix, and external force vector concerning the degrees of freedom of components by using Euler-Lagrange equations is shown to understand the structure and process of dynamic analysis. The code application by explaining how to use the code in a different mechanical system is also shown to help understand the usage method for who wants to study Multi-body dynamics.