Scalar Discrete LQR Gain
~15 mincode completion
Implement scalar_lqr(a, b, q, r, n_iters) returning the array [K, P] after n_iters updates.
Where this shows up
~15 min
••••••••••••
6 employers weight this skill
4 autonomy companies, 2 defense companies. Top match scores 92.
Python
import numpy as np
def scalar_lqr(a, b, q, r, n_iters):
"""
Iterate the scalar discrete Riccati equation and return the LQR gain.
Args:
a, b: plant x_{k+1} = a x_k + b u_k
q, r: per-step cost q x^2 + r u^2
n_iters: number of Riccati updates, starting from P = q
Returns:
array [K, P]: the gain for u = -K x and the final P
"""
# YOUR CODE HERE
pass