# How to model and simulate large nonlinear coupled mechanical systems effectively?

6 views (last 30 days)
Commented: Maradona on 2 Jul 2021
Dear community,
I am modeling a mechanical system using Lagrangian dynamics. The system is nonlinear and coupled.
I am trying to find the numerical solution to the equations of motion of such system.
My approach is as follows:
1. Write the N nonlinear coupled equations of motion as symbolic expressions. These are functions of the N generalized coordinates and their first and second time derivatives.
2. Solve for the N second derivatives using the solve command to obtain N second order ODE’s.
3. Transform the system to obtain 2N first order ODE’s.
4. Use ode45 to integrate the equations and obtain the solution to initial conditions.
This approach does work very well when dealing with “small and simple” systems. Still, as the order of the system and its complexity in terms of coupling and nonlinearity increases, the step involving using the built-in solve function becomes impracticable; Matlab keeps busy indefinitely and does not give an output.
Does anyone have any suggestions concerning modeling and simulating large nonlinear coupled mechanical systems?

Paul on 2 Jul 2021
Edited: Paul on 2 Jul 2021
I think steps 2 and 3 can be replaced with:
doc odeToVectorField
If not, post a simple example to illustrate the problem.
I agree, steps 2 and 3 can be addressed by odeToVectorField. But still, as the order of the system increases, when using odeToVectorField, Matlab also keeps busy indefinitely and does not give an output.
I'll post an illustration of the problem asap.

R2019a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!