I am trying to solve a system of nonlinear equations of motion in Simulink, where
x = [x1...x7] is the system state with the derivatives xdot = [x1dot...x7dot] and xdotdot = [x1dotdot...x7dotdot],
p = [p1...pn] are parameters (partly non constant) and
u = [u1...u3] is the system input.
All 7 equations are nonlinear, e.g.
p2*x2dotdot - p3*x3dotdot + p4*x4dotdot + p5*x4dot*x5dot - p6*x5 + p7 + u1 = 0;
As a result of this form, the second derivatives depend on another. This leads to a set of equations
x1dotdot = f1(p,u,x,xdot)
x2dotdot = f2(p,u,x,xdot,x3dotdot,x4dotdot,x5dotdot)
x3dotdot = f3(p,u,x,xdot,x2dotdot,x4dotdot,x5dotdot)
x4dotdot = f4(p,u,x,xdot,x2dotdot,x3dotdot,x5dotdot)
What I have tried so far is implementing the equations in a simulink model without changing their form. By adding unit delays I solved the equations based on the previous xdotdot.
Another way I tried was by solving the equations for x and xdot using the solve function to get a system of the form xdotdot = f(p,u,x,xdot). Based on this, I tried to change the system to a first order system by expanding x to [x, xdot].
However, all of these tries have lead to bad results (values getting very large + stepsize errors).
How should I go about solving these equations where the derivatives depend on another?