The optimal way to balance an inverted pendulum. Set your cost weights and watch the Riccati equation hand you the controller that stabilizes a cart-pole.
LQR Control StudioLive
optimal state-feedback stabilization
Controls
Balance an inverted pendulum with an optimal controller. The gain K is computed by solving the Riccati equation for your Q/R weights — not hand-tuned. Cheap control (low R) reacts hard; expensive control (high R) acts gently.
Reading this result: LQR balances state error against control effort here (R = 0.3): the pole recovers in about 6.3 s with a peak force near 14 N. Lower R to react harder, raise it to act gentler.
Runs locally in your browser — free forever. Scale to the cloud when reality gets heavy.
★ Sign in to save this setupSave your tuned setup, or drop this simulation into your own site, docs, or course page.
How it works
Linear-Quadratic Regulator (LQR) design starts from the cart-pole linearized about its upright equilibrium, ẋ = Ax + Bu. You choose a cost J = ∫(xᵀQx + uᵀRu) dt — Q penalizes state error (cart position and pole angle), R penalizes control effort. The solver finds the gain K = R⁻¹BᵀP by solving the continuous-time algebraic Riccati equation, then simulates the closed loop ẋ = (A − BK)x from a disturbed start. Cheap control (small R) yields an aggressive gain that snaps the pole upright; expensive control (large R) gives a gentle, slower recovery. The closed-loop eigenvalues always land in the left half-plane, so the pendulum provably stabilizes.
✦
Ask the AI about this model
The math, the assumptions, real-world uses, or a code translation — explained for this exact simulation.
Is this LQR optimal control pole placement tool really free?▾
Yes. LQR Control runs entirely in your browser using your device's own compute, so local use is free forever. You only pay Compute Tokens if you scale a job to the cloud.
Do I need to install anything?▾
No. Everything runs client-side in a modern browser — no downloads, no license, no account required to start.
Can I save or share my simulation?▾
Create a free account to save projects, and use a shareable embed or minted DOI to publish a live, interactive version anywhere.
How accurate are the results?▾
The solver uses established numerical methods, but results are for research and educational purposes and should be validated against experiment or professional review before you rely on them.