Skip to content

Real-world "Stiff system" Example for ODE page #78

@tordnat

Description

@tordnat

Stiff System: Voltage-Controlled DC Motor Arm

State & Dynamics

State vector: $x = [\theta, \dot{\theta}, i]^T$

Subsystem Equation Time Constant
Electrical $\dot{i} = (v - Ri - K_b\dot{\theta})/L$ $\tau_e = L/R \sim 10^{-4}$ s
Mechanical $\ddot{\theta} = (K_t i - b\dot{\theta})/J$ $\tau_m = J/b \sim 10^{-1}$ s
Control $v = -K_p(\theta - \theta_d) - K_d\dot{\theta}$

Student implementation note: Implicit methods allow ~1000× larger $\Delta t$, but each step requires solving a nonlinear system (Newton iteration with Jacobian). A naive implementation may only see ~10–50× wall-clock speedup. Production solvers (Radau, ESDIRK) achieve greater gains through adaptive stepping, efficient linear algebra, and Jacobian reuse.

Demo Outline

  1. Sweep $K_p \in [10, 10^4]$
  2. Compare step counts: explicit RK4 vs student-implemented backward Euler vs Radau
  3. Plot Jacobian eigenvalues vs gain
  4. Measure wall-clock time to show implicit overhead vs stability benefit

Notes

  • Equations follow standard DC motor model (Kirchhoff + Newton-Euler)
  • Voltage-mode control assumed (not torque-mode)
  • $K_d\dot{\theta}$ term couples into electrical dynamics via $v$, contributing additional stiffness
  • Production solvers: SciPy's Radau (implicit RK) and MATLAB's ode15s (BDF, a multistep method) both handle stiffness; this course focuses on RK formulations

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions