# Optimal control via weighted least-squares

$y$,$y^\mathrm{des}$
$t$

The input signal $x = (x_1,\ldots,x_T)$ is to be chosen.

The output $y$ is given by $y_t = \sum_{i=1}^{k} h_i x_{t-i}$. ($x_i$ is taken to be 0 for $i \leq 0$.)

The goal is to choose the input signal $x$ such that $y \approx y^\mathrm{des}$ and $x$ is smooth.

To measure how well $y$ tracks $y^\mathrm{des}$, we use the cost $J^\mathrm{track} = \sum_{t=1}^T (y_t^\mathrm{des} - y_t)^2$.

To measure the roughness of $x$, we use $J^\mathrm{rough} = \sum_{t=2}^T (x_t - x_{t-1})^2$.

To find $x$ we minimize $J^\mathrm{track} + \gamma J^\mathrm{rough}$,
where $\gamma > 0$ controls the amount of smoothing on the input.

$\gamma=$

0

$x$
$t$
$J^\mathrm{smooth}$
$J^\mathrm{track}$