Skip to content
Back to Projects

Multibody and Nonlinear Dynamics

December 1, 2025Completedacademic
control-systems matlab modeling

Overview

In the MSc course Multibody and Nonlinear Dynamics (4DM10, Q2 2025–2026) at TU Eindhoven, I completed two substantial take-home assignments. The first assignment covers multibody dynamics — deriving a constrained DAE model of a floating telescopic crane and simulating its forced response. The second covers nonlinear dynamics — passivity-based energy-tracking control of an oscillating mass on a rolling ring, plus a Lyapunov stability analysis of a COVID-25 SIR epidemic model with vaccination.

Assignment 1 Report — Floating Telescopic Crane
Assignment 2 Report — Energy Control & Epidemic Dynamics

Assignment 1 — Floating Telescopic Crane

The first assignment models an offshore floating telescopic crane — the kind used for heavy-lift construction — as a planar constrained multibody system. The schematic on the left of the thumbnail shows the three rigid bodies (boat, rotary arm, telescopic rod with a point-mass load) together with the buoyancy spring-damper pair, the cable spring k1k_1, the rotary motor MM, and the prismatic actuator force FF.

System and coordinates

Free-body sketch of the floating telescopic crane: boat (body 1) on water with buoyancy springs and dampers; rotary arm (body 2) pivoting at the boat with motor torque M; telescopic rod (body 3) sliding in the arm under prismatic force F; cable spring k1 hanging the point-mass load m_L from the rod tip.

The system uses the full redundant coordinate set

q=[x1y1θ1x2y2θ2x3y3θ3] ⁣.\underline{q} = \begin{bmatrix} x_1 & y_1 & \theta_1 & x_2 & y_2 & \theta_2 & x_3 & y_3 & \theta_3 \end{bmatrix}^{\!\top}.

With 9 generalized coordinates and 5 holonomic scleronomic constraints (one translational for the boat, a revolute joint coupling body 1 to body 2, and a prismatic joint coupling body 2 to body 3), the system has 4 degrees of freedom. The coordinates are therefore dependent and call for the Lagrange-multiplier formulation.

Problem 1 — Model derivation

Following the standard Lagrangian workflow, I derived:

  1. Constraint equations h(q)=0\underline{h}(\underline{q}) = \underline{0} for the three joints (2 equations from the revolute pair, 2 from the prismatic pair, 1 from the boat translation lock).
  2. Kinetic energy T(q,q˙)T(\underline{q}, \dot{\underline{q}}) — including the cross-coupling term from the point-mass load mLm_L rigidly fixed at the rod tip.
  3. Potential energy V(q)V(\underline{q}) — gravitational plus the three elastic terms (buoyancy kwk_w at each hull point, cable k1k_1, and internal telescopic spring k2k_2).
  4. Non-conservative generalized forces Qnc\underline{Q}^{\text{nc}} — wave forces Fw1,Fw2\vec{F}_{w_1}, \vec{F}_{w_2}, motor torque MM, prismatic force FF, and the two viscous dampers dw,dt,dd_w, d_t, d.
  5. Equations of motion in the standard DAE form
M(q)q¨+H(q,q˙)=S(q)τ+W(q)λ.\underline{M}(\underline{q})\,\ddot{\underline{q}} + \underline{H}(\underline{q}, \dot{\underline{q}}) = \underline{S}(\underline{q})\,\underline{\tau} + \underline{W}(\underline{q})\,\underline{\lambda}.

With four independent motions and two applied inputs (MM and FF), the system is underactuated — the wave-induced sway and heave of the boat cannot be driven directly, only compensated for through the rotary joint.

Problem 1.7 — Forward dynamic simulation

Given the parameter table, the piecewise inputs

F(t)={0,0t<15107(t15)35,15t<50107,t50M(t)={0,0t<158107(t15)35,15t<508107,t50F(t) = \begin{cases} 0, & 0 \le t < 15\\[2pt] \tfrac{10^7 (t-15)}{35}, & 15 \le t < 50\\[2pt] 10^7, & t \ge 50 \end{cases} \quad M(t) = \begin{cases} 0, & 0 \le t < 15\\[2pt] \tfrac{8\cdot 10^7 (t-15)}{35}, & 15 \le t < 50\\[2pt] 8\cdot 10^7, & t \ge 50 \end{cases}

plus sinusoidal wave forces Fw1(t)=108sin2(0.1t+π/4)F_{w_1}(t) = 10^8 \sin^2(0.1 t + \pi/4) and Fw2(t)=108sin2(0.1t)F_{w_2}(t) = 10^8 \sin^2(0.1 t), I integrated the index-3 DAE with MATLAB's ode15s (stiff solver) over t[0,300]t \in [0, 300] s. Baumgarte stabilization (with manually tuned α\alpha, β\beta) added to the second-derivative form of the constraint equations kept constraint drift within h(q)<106\|\underline{h}(\underline{q})\|_\infty < 10^{-6} throughout the full 300-second simulation — essential at these actuator magnitudes (107\sim 10^710810^8), where naive integration drifts in seconds.

Problem 2 — Simplified linear dynamics & FRF

For Problem 2 the rod and arm were rigidly fused (no telescoping), reducing the system to the minimal coordinate set qmin=[y1,θ1,θ2]\underline{q}_{\min} = [y_1, \theta_1, \theta_2]^\top. With mL=0m_L = 0 and the wave forces set to zero, the nonlinear equations of motion reduce to three coupled ODEs (equations 7a–7c of the assignment), which I linearized around the equilibrium

qe[0.00830.05770.0288]\underline{q}_e \approx \begin{bmatrix} -0.0083 \\ -0.0577 \\ -0.0288 \end{bmatrix}

to obtain Ml,Dl,Kl,Sl\underline{M}_l, \underline{D}_l, \underline{K}_l, \underline{S}_l. The eigenvalues of the linearized second-order system all had negative real parts, confirming local asymptotic stability of the operating point. The three undamped eigenmodes correspond to the heave y1y_1 mode (buoyancy spring), the boat-tilt θ1\theta_1 mode, and the arm θ2\theta_2 mode, and their eigenvectors clearly separate vertical from rotational motion at the low-frequency end of the spectrum.

The frequency response function from actuator torque MM to boat heave y1y_1 was then computed analytically from the linearized matrices:

Y1(jω)M(jω)=c(Klω2Ml)1b,\frac{Y_1(j\omega)}{M(j\omega)} = \underline{c}^\top \Big(\underline{K}_l - \omega^2 \underline{M}_l\Big)^{-1} \underline{b},

with the low-frequency slope explained by compliance of the buoyancy spring and the two resonance peaks lining up with the computed eigenfrequencies.

Problem 2.3 — Inverse dynamics for wave compensation

Given measured boat motion y1(t)=1.16sin(0.2tπ/4)+1.55y_1(t) = 1.16 \sin(0.2t - \pi/4) + 1.55 and θ1(t)=0.09sin(0.2t+π/6)0.06\theta_1(t) = 0.09 \sin(0.2t + \pi/6) - 0.06, the task was to reconstruct the torque M(t)M(t) that would generate exactly this motion on the physical system (an inverse-dynamics problem). Substituting the measured trajectory and its analytical derivatives into equation 7b directly yields M(t)M(t) with no integration required — a clean demonstration of the inverse-dynamic property of a reference trajectory for a smooth multibody system.

Assignment 2 — Nonlinear Dynamics

Assignment 2 split into two independent problems, both showcasing classical nonlinear-dynamics tools.

Problem 1 — Passivity-based energy control of an oscillating mass on a ring

A uniform ring (mass MM, inner radius RiR_i, outer radius RoR_o) rolls without slipping on a flat surface. A point mass mm is mounted inside the ring, connected to the center via two identical springs of stiffness kk and rest length RiR_i, free to slide along a body-fixed radial axis. An actuator applies a force FF on the point mass along that same axis, with reaction forces 12F-\tfrac{1}{2}F on each ring-contact point. The independent coordinates are

q=[θ],\underline{q} = \begin{bmatrix} \theta \\ \ell \end{bmatrix},

where θ\theta is the ring-rotation angle and \ell is the signed mass displacement from the ring center.

After deriving the Euler–Lagrange equations and expressing the total mechanical energy

H(q,q˙)=T(q,q˙)+V(q),H(\underline{q}, \dot{\underline{q}}) = T(\underline{q}, \dot{\underline{q}}) + V(\underline{q}),

the key observation is that differentiating HH along the flow yields

H˙=F˙,\dot{H} = F\,\dot{\ell},

so the system is passive from input FF to output y=˙y = \dot{\ell}. That one line makes an energy-shaping control law available immediately.

The Lyapunov-based energy-tracking controller

The assignment asks us to design a feedback law that drives HH to a prescribed target energy H>0H_* > 0. Using the Lyapunov candidate

V(q,q˙)=12γ(H(q,q˙)H)2,γ>0,V(\underline{q}, \dot{\underline{q}}) = \frac{1}{2\gamma}\bigl(H(\underline{q}, \dot{\underline{q}}) - H_*\bigr)^2, \qquad \gamma > 0,

the derivative along the flow is V˙=1γ(HH)H˙=1γ(HH)F˙\dot{V} = \tfrac{1}{\gamma}(H - H_*)\dot{H} = \tfrac{1}{\gamma}(H - H_*) F\dot{\ell}. Choosing the control law

F=γ˙(HH)F = -\gamma\,\dot{\ell}\,(H - H_*)

yields V˙=(˙)2(HH)2/γ0\dot{V} = -(\dot{\ell})^2 (H - H_*)^2 / \gamma \le 0, giving convergence to the invariant set {˙=0}{H=H}\{\dot{\ell} = 0\} \cup \{H = H_*\}. By LaSalle's invariance principle, trajectories either converge to the desired energy level or to an equilibrium with zero mass oscillation — no linearization, no feedback linearization, just passivity + Lyapunov.

Numerical exploration (Problem 1.5)

Simulating the closed loop with γ=0.5\gamma = 0.5, M=4M = 4 kg, m=1m = 1 kg, Ri=0.8R_i = 0.8 m, Ro=1R_o = 1 m, k=20k = 20 N/m showed three distinct asymptotic regimes depending on HH_*:

RegimeAsymptotic behavior
H<HminH_* < H_{\min}System settles at HminH_{\min} (target unreachable)
HminH<HpH_{\min} \le H_* < H_pRing oscillates about bottom equilibrium
H>HpH_* > H_pRing rotates indefinitely — enough energy to escape

The threshold HpH_p is the potential barrier (energy needed to lift the point mass to the top of the ring) — a clean physical interpretation of a bifurcation in an otherwise abstract Lyapunov analysis.

Top: total energy H(t) for four initial energies converging to the target H* under the passivity-based control law F = -γ ℓ̇ (H - H*). Bottom: Lyapunov function V = (H - H*)^2 / (2γ) on a log scale, monotonically decreasing toward zero.

Energy-tracking simulation on a 1-DOF surrogate (m¨+k=Fm\ddot\ell + k\ell = F). Top: H(t)H(t) converges to HH_* for four different initial energies. Bottom: the Lyapunov candidate V=(HH)2/(2γ)V = (H-H_*)^2/(2\gamma) decays monotonically (log-scale) — exactly the behavior LaSalle's principle guarantees.

Problem 2 — COVID-25: SIR dynamics, stability, and vaccination

The second problem treats a population split into vulnerable (x1x_1), contaminated (x2x_2), and immune (x3x_3) compartments of constant total NN. After normalization to fractions v=x1/Nv = x_1/N, c=x2/Nc = x_2/N, i=x3/Ni = x_3/N, the reduced state-space model becomes

{v˙=ββvγcvc˙=βc+γcvμc\begin{cases} \dot{v} = \beta - \beta v - \gamma\,c\,v\\ \dot{c} = -\beta c + \gamma\,c\,v - \mu c \end{cases}

with i=1vci = 1 - v - c. The set I={(v,c):v0,c0,v+c1}\mathcal{I} = \{(v, c): v \ge 0, c \ge 0, v + c \le 1\} is forward-invariant (each boundary face is crossed inward by the vector field), so the reduced model suffices.

Equilibria and the epidemic threshold θ\theta

Introducing the dimensionless group

θ:=γβ+μ,\theta := \frac{\gamma}{\beta + \mu},

the equilibria are the disease-free point (v,c)=(1,0)(v^*, c^*) = (1, 0) and — when θ>1\theta > 1 — the endemic point (v,c)=(1θ,ββ+μ(11θ))\bigl(v^*, c^*\bigr) = \bigl(\tfrac{1}{\theta}, \tfrac{\beta}{\beta + \mu}\bigl(1 - \tfrac{1}{\theta}\bigr)\bigr). Linearization classifies the disease-free equilibrium as a stable node for θ<1\theta < 1 and a saddle for θ>1\theta > 1. The endemic equilibrium's global asymptotic stability for θ>1\theta > 1 is proven using the radially unbounded Lyapunov candidate

V(v,c)=(vvlnvv)+(cclncc),V(v, c) = \bigl(v - v^* \ln \tfrac{v}{v^*}\bigr) + \bigl(c - c^* \ln \tfrac{c}{c^*}\bigr),

whose time derivative reduces to c(β+μ)(2vθ1/(vθ))/20-c(\beta + \mu)(2 - v\theta - 1/(v\theta))/2 \le 0 after the algebraic identity (θv1)20(\theta v - 1)^2 \ge 0.

Vaccination control & bifurcation

Adding a vaccination rate uu that sends a fraction of newborns directly from vulnerable to immune modifies the vulnerable equation to v˙=ββvγcvβu\dot{v} = \beta - \beta v - \gamma c v - \beta u. With a 90%-efficient vaccine, the required vaccination rate to eliminate the endemic equilibrium works out to u10.9(11θ)u \ge \tfrac{1}{0.9}\bigl(1 - \tfrac{1}{\theta}\bigr); with a 100%-efficient vaccine the bifurcation occurs cleanly at u=11/θu = 1 - 1/\theta. Plotting cc^* vs. uu gives a transcritical bifurcation diagram where the endemic branch collapses into the disease-free one exactly at the predicted uu.

Transcritical bifurcation diagram: endemic equilibrium c* decreases linearly with vaccination rate u and crashes into the disease-free branch at u_c = 1 - 1/θ. Below u_c the endemic branch is stable and the disease-free branch is unstable; above u_c they exchange stability.

Results & Reflections

These two assignments were the most mathematically demanding course work of Q2. The multibody assignment taught me how Baumgarte stabilization quietly saves a naive DAE solver from constraint drift — without it, the crane simulation diverges within seconds under 10810^8-magnitude loads. The nonlinear assignment was a reminder that passivity arguments are often shorter than the linearized analysis they replace: one line of H˙=F˙\dot{H} = F\dot{\ell} completely determines a globally stabilizing control law, where a linearized design would leave large regions of state space uncovered. The epidemiological half of Assignment 2 was a welcome change of domain — same Lyapunov toolkit, different physical interpretation.

Technologies Used

MATLAB (ode15s, symbolic toolbox, solve, vpa), Lagrangian mechanics with multipliers, Baumgarte constraint stabilization, passivity-based control, LaSalle's invariance principle, bifurcation analysis, frequency response analysis