## 7 Dynamic Simulation  
In order to carry out the dynamic simulation of the elephant's head-trunk system, the equations of motion, as presented in Equation (17), were modified for the rigid-flexible multibody system, taking the form of  
Figure 18: Kinematic movements of an elephant’s trunk: (**a**) Manipulating (Extension and Partial Flexion): The trunk extends outward to reach and interact with the object; the slight upward flexion at the tip suggests the delicate precision required for picking up or manipulating items. (**b**) Picking (Coiled Flexion with Gripping): The trunk is tightly coiled around an object, which requires the precise activation of transverse and oblique muscles, enabling the trunk to obtain a secure grip on the object. (**c**) Eating Directly (High Flexion with Lifting): The trunk lifts the food item directly to the mouth without additional manipulation. Flexion and upward lift are characteristic of this motion, achieved through transverse and dorsal muscle activation. (**d**) Gripping (High Coiled Flexion): The trunk grips the object, coiling to apply precise force for some actions. This involves a combination of transverse and oblique muscle activation. \[ \begin{bmatrix}\mathbf{M}_{RF}&\mathbf{C}_{q}^{T}\\ \mathbf{C}_{q}&\mathbf{0}\end{bmatrix}\begin{bmatrix}\ddot{\mathbf{q}}\\ \ddot{\mathbf{-}}\end{bmatrix} = \begin{bmatrix}\mathbf{Q}\\ \mathbf{\dot{\mathbf{-}}}\end{bmatrix}  \tag{49}\]  
\[\mathbf{M}_{RF}= \begin{bmatrix}\mathbf{M}_{r}&0\\ 0&\mathbf{M}_{f}\end{bmatrix} ,\qquad\mathbf{Q}= \begin{bmatrix}\mathbf{Q}_{r} \\ \mathbf{Q}_{ex}-\mathbf{Q}_{c}\end{bmatrix} \]  
\[\Phi_{q}\ddot{\mathbf{q}}=-\left(\Phi_{q}\dot{\mathbf{q}}\right)_{q}\ddot{ \mathbf{q}}-2\Phi_{q}\dot{\mathbf{q}}-\Phi  
to make appropriate corrective actions. Defuzzification converts the fuzzy outputs into crisp values for the purpose of stabilization corrections. The FLC output is estimated by a Sugeno-type system, significantly enhancing the efficiency of defuzzification. Unlike the Mamdani approach, whose distributed fuzzy sets require computationally expensive calculations, the Sugeno approach utilizes a singleton output membership function, a single spike representation [34].  
Violations in the constraints in the system create unknown disturbances, represented as \(\tilde{\mathbf{U}}^{h}\). These disturbances affect the motion of the system, and thus  
\[\tilde{\boldsymbol{\phi}}(\mathbf{q},\dot{\mathbf{q}},t)+\tilde{\mathbf{U}}^{ h}=0 \tag{52}\]  
In order to compensate for this drift, the FLC generates the adjusting action, \(\mathbf{U}^{h}(\boldsymbol{\phi},\dot{\boldsymbol{\phi}},t)\), ensuring that the system remains stable. FLC compensates for drifting by setting \(\mathbf{U}^{h}=\tilde{\mathbf{U}}^{h}\), leading to the modified equation  
\[\tilde{\boldsymbol{\phi}}(\mathbf{q},\dot{\mathbf{q}},t)+\mathbf{U}^{h}= \boldsymbol{\phi}_{\dot{q}}\ddot{\mathbf{q}}-\boldsymbol{\gamma}+\mathbf{U}^{ h}=0 \tag{53}\]  
This equation can be simplified to  
\[\boldsymbol{\phi}_{\dot{q}}\ddot{\mathbf{q}}=\boldsymbol{\gamma}-\mathbf{U}^ {h} \tag{54}\]  
When applying the FLC approach for stabilization, the system dynamically adjusts to minimize constraint violations and maintain accurate motion. This technique enhances stability, and thus it is suitable for complex multibody simulations. The numerical solution employs a variable-step, variable-order integrator, namely, the Adams-Bashforth-Moulton method, which is a multistep predictor-corrector integration approach. When paired with the FLC stabilization strategy, the computational efficiency and stability are optimized. It can be concluded that this approach ensures precise constraint handling and dynamic consistency, even under complex loading scenarios, such as lifting, bending, and twisting movements. Figure 19: Dynamic simulation of an elephant’s head–trunk system when torque is applied to the rigid head. To validate the simulation and assess its accuracy, the results were compared with the actual motion of an elephant's trunk.