AbstractModeling of a dynamical system is an important research area to obtain mathematical models of real systems. There are several approaches to get mathematical models, one of them is utilizing the Lagrangian of holonomic systems. This paper introduces LagranTexPac, a package Matlab-based framework aimed at obtaining, and simulate the equations of motion of a mechanical system. LagranTexPac uses the Lagrangian function of a system to automatically generate the system equations of motion for numerically simulate and saves all phase portraits. Motion constraints can be included in Lagrangian, and a summary report can be generated. Utility of this software tool includes any engineer area, in which is used a Lagrangian function to obtain the equations of motion of a dynamic system, e.g., aerospace, biomedical, robotics and mechanical engineering. Three application examples are included to illustrate the usefulness of this software tool. Index TermsDynamical systems, contact dynamics, matlab®, code generation, LATEX report generation, simulation tool. I. INTRODUCTION Dynamical systems are studied in several areas of engi- neering, in which system modeling is necessary to study and analyze the system behaviors. Newtons laws can be used to model dynamical systems and the development procedure may be complex. An alternative approach used to model systems is the Lagrangian function, wherewith the Lagrangian equations are obtained. Last approach can be less complex than the first one A few tool packages are available to obtain the Lagrangian equations in Matlab framework. Some years ago, there was no software package to help in the procedure to obtain the Lagrangian equations of dynamical systems. To derive equations of the dynamical system is a fatigued procedure. In [1], [2] were shown Matlab® toolboxes that resolve Euler- Lagrange equation and provide ODE equations for numerically simulation of a system. Those toolboxes do not interact with L A T E X. In [3] was reported a package to generate some L A T E X features to use with Matlab ® , in [4] was viewed a similar technique used to create a simple L A T E X files directly from Matlab ® and in [5] was used a package to format the Matlab ® code syntax inside a L A T E X document. Lagrangian is a mathematical function, which is a function of the generalized coordinates. These coordinates and their Manuscript received August 7, 2016; revised December 7, 2016. This work was supported in part by the agency CAPES. F. H. G. Zucatelli, M. E. M. Meza and A. Fenili are with the Graduate Program in Mechanical Engineering, Federal University of ABC, Santo André, SP09210-580, BRAZIL (e-mail: fernando.zucatelli@aluno.ufabc.edu.br, magno.meza@ufabc.edu.br, andre.fenili@ufabc.edu.br) time derivatives contain information about the dynamics of the system. The dynamical model of a generic system can be described as follows: f y y (1) where y R n is a vector state and f: U R n R n is a vector field and describes an autonomous system [6]-[8]. In [9]-[11] were introduced different approaches to determine differential equations of the system dynamics. Examples about robot manipulators can be found in [10], [12], in [7], [8] were shown examples about nonlinear dynamical systems, in [13], [14] were illustrated examples about triple- pendulum arm and constrain to the movement for a mechanical system, respectively. In the triple-pendulum context, [13], [15] show the fatigued work to obtain differential equations of dynamic system, and can be seen some development mistakes like the forgotten term m 2 z 2 2 , in [13] at the mass matrix. This was one of motivations to develop the this tool to avoid writing mistakes or forgetting mistakes, and another motivation was to provide a file with the differential equations to simulate in Matlab ® framework. An important feature of the tool is to implement equations of the system dynamics taking into account constraints to the motion, which is part ot the contacts dynamics and this topic was not considered in [1], [2]. Studied system in [14] was considered as an application of this feature of tool. Another feature of tool is to produce a summarized report of all development steps to obtain the differential equations of the system dynamics, and the report is generated to be used in a L A T E X framework. The command used to write a line in a L A T E X file is reported in [4], in this tool it is created a function to write the whole report selecting the language between English, German, Spanish or Potuguese. Therefore, the aim of Matlab ® tool is to make possible a fast analysis and simulation of dynamic equations with or without constraints to the motion, avoiding written mistake and forgotten mistakes and to make possible checking intermediate steps. This article is organized as follows: in Section II is shown a summary of the Euler-Lagranges equation of motion; in Section III is briefly designed the development of the tool; in Section IV is shown three application examples and finally in Section V is shown conclusions. II. EULER-LAGRANGES EQUATIONS OF MOTION. Dynamical systems can be described by a set of simulta- neous differential equations known as Lagranges equations according to [6], [9] and the system dynamics can be defined LagranTexPac: A Software Tool to Obtain the Dynamic Equations of Mechanical Systems Fernando Henrique Gomes Zucatelli, Magno Enrique Mendoza Meza, and André Fenili 242 International Journal of Computer Theory and Engineering, Vol. 9, No. 4, August 2017 DOI: 10.7763/IJCTE.2017.V9.1145