Documentation |
Form state estimator given estimator gain
est = estim(sys,L)
est = estim(sys,L,sensors,known)
est = estim(sys,L) produces a state/output estimator est given the plant state-space model sys and the estimator gain L. All inputs w of sys are assumed stochastic (process and/or measurement noise), and all outputs y are measured. The estimator est is returned in state-space form (SS object).
For a continuous-time plant sys with equations
$$\begin{array}{l}\dot{x}=Ax+Bw\\ y=Cx+Dw\end{array}$$
estim uses the following equations to generate a plant output estimate $$\widehat{y}$$ and a state estimate $$\widehat{x}$$, which are estimates of y(t)=C and x(t), respectively:
$$\begin{array}{l}\dot{\widehat{x}}=A\widehat{x}+L(y-C\widehat{x})\\ \left[\begin{array}{c}\widehat{y}\\ \widehat{x}\end{array}\right]=\left[\begin{array}{c}C\\ I\end{array}\right]\widehat{x}\end{array}$$
For a discrete-time plant sys with the following equations:
$$\begin{array}{l}x[n+1]=Ax[n]+Bw[n]\\ y[n]=Cx[n]+Dw[n]\end{array}$$
estim uses estimator equations similar to those for continuous-time to generate a plant output estimate $$y[n|n-1]$$ and a state estimate $$x[n|n-1]$$, which are estimates of y[n] and x[n], respectively. These estimates are based on past measurements up to y[n-1].
est = estim(sys,L,sensors,known) handles more general plants sys with both known (deterministic) inputs u and stochastic inputs w, and both measured outputs y and nonmeasured outputs z.
$$\begin{array}{l}\dot{x}=Ax+{B}_{1}w+{B}_{2}u\\ \left[\begin{array}{c}z\\ y\end{array}\right]=\left[\begin{array}{c}{C}_{1}\\ {C}_{2}\end{array}\right]x+\left[\begin{array}{c}{D}_{11}\\ {D}_{21}\end{array}\right]w+\left[\begin{array}{c}{D}_{12}\\ {D}_{22}\end{array}\right]u\end{array}$$
The index vectors sensors and known specify which outputs of sys are measured (y), and which inputs of sys are known (u). The resulting estimator est, found using the following equations, uses both u and y to produce the output and state estimates.
$$\begin{array}{l}\dot{\widehat{x}}=A\widehat{x}+{B}_{2}u+L(y-{C}_{2}\widehat{x}-{D}_{22}u)\\ \left[\begin{array}{c}\widehat{y}\\ \widehat{x}\end{array}\right]=\left[\begin{array}{c}{C}_{2}\\ I\end{array}\right]\widehat{x}+\left[\begin{array}{c}{D}_{22}\\ 0\end{array}\right]u\end{array}$$
Consider a state-space model sys with seven outputs and four inputs. Suppose you designed a Kalman gain matrix L using outputs 4, 7, and 1 of the plant as sensor measurements and inputs 1, 4, and 3 of the plant as known (deterministic) inputs. You can then form the Kalman estimator by
sensors = [4,7,1]; known = [1,4,3]; est = estim(sys,L,sensors,known)
See the function kalman for direct Kalman estimator design.