Build Regulators and Observers for Systems
Build Regulators and Observers for Systems
The trajectories of the states and a Luenberger observer's state estimates.
{a, b, c} = {({{0.81, -0.23, -0.045}, {0.09, 0.98, -0.0023}, {0.005, 0.1, 1}}), ({{0.09}, {0.0047}, {0.00016}}), ({{1, 3.5, 3}})};ss = StateSpaceModel[{a, b, c}, SamplingPeriod -> 0.1];
l = EstimatorGains[ss, {0.5, 0.6, 0.75}];
ssobsv = StateSpaceModel[{a - l.c, l, IdentityMatrix[3]}, SamplingPeriod -> 0.1];
stateResp = StateResponse[{ss, {1, -0.75, 0.5}}, {0}, {t, 6}];
y = OutputResponse[{ss, {1, -0.75, 0.5}}, {0}, {t, 6}];
obsvResp = OutputResponse[ssobsv, y];
tspan = Range[0, 6, 0.1];ListPlot[Replace[Join[stateResp, obsvResp], pts : {__} :> Thread[{tspan, pts}], {1}], PlotRange -> All, PlotMarkers -> {"*", "o", "@", "+", "#", "x"}, Epilog -> Inset[Framed[Style[Column[{*----x
1, +---x
1obs, o----x
2, #----x
2obs, @----x
3, x---x
3obs}], 10]], {5, 0.6}], AxesLabel -> {"t"}, ImageSize -> 350, Joined -> True]