ModelSim Lab
A space to experimentOpen lab

Inverted Pendulum

ORDER 4 · ADVANCED

Balance an unstable system. Connect feedback force, cart motion and pendulum angle.

Physical system

PHYSICAL SYSTEMθ = 0 at upright · schematic scale
θ = 0.1 radcart x = 0 m · u = 0 N
Motion follows the computed statest = 0 s
(M+m)x¨+bx˙+ml(θ¨cos⁡θ−θ˙2sin⁡θ)=u,lθ¨+x¨cos⁡θ−gsin⁡θ=0(M+m)\ddot{x}+b\dot{x}+ml(\ddot\theta\cos\theta-\dot\theta^2\sin\theta)=u,\quad l\ddot\theta+\ddot{x}\cos\theta-g\sin\theta=0
0.00 / 10 s
Large angle excursion: the pendulum moved more than 0.35 rad from upright. This describes physical motion, not necessarily a numerical error or a failure to recover.

Pendulum angle response

Scroll to zoom · drag to pan · click a legend to hide a trace

1001 samples. Primary output ends at 5.751 rad. Export CSV for all data.
3.776 rad
Not applicable
6.097 rad
5.751 rad
Not applicable
Not applicable
Not observed
1.73 s

1,001 samples · 1,000 internal RK4 steps · Model and result in sync