7
$\begingroup$

I'm trying to build a human operator model using an optimal control model in Mathematica: Human operator model

The vehicle dynamics are given by

a = {{-2, 0}, {1, 0}};
b = {{0}, {1}};
c = {{0, 1}, {1, 0}};
d = {{0}, {1}};

with noise and cost weightings

w = {{4}};
v = {{0.0025}};
q = {{0, 0}, {0, 1}};
r = {{1}};

I generated the state space model and added the time delay ($T_d = 0.2s$) using

ssm = StateSpaceModel[{a, b, c, d}]
td = TransferFunctionModel[SystemsModelDelay[.2]];
ssmWithDelay = SystemsModelSeriesConnect[td, ssm];

Now I am trying model the Kalman estimator and gains ($-l^*$) using a LQG regulator

k = LQGRegulator[{ssm, 1, 1}, {w, v}, {q, r}] // StateSpaceModel

which results in the error

The number of columns in {{},{}} is not equal to the length of {{4}}

I think my problem must be with the noise and cost weightings, but I'm not sure where I went wrong?

$\endgroup$
  • 1
    $\begingroup$ In the figure, the system 'vehicle dynamics' has two inputs - the disturbance and the feedback input, so probably the b and d matrices need to have two columns as well. $\endgroup$ – Suba Thomas Mar 19 '13 at 18:46
  • $\begingroup$ I thought the disturbance is represented by the $\mathbf{W}$ noise term in $\dot{x}(t) = \mathbf{A}x(t) + \mathbf{B}u(t) + \mathbf{W}(t)$ $\endgroup$ – Gerrit Mar 20 '13 at 9:16
  • $\begingroup$ That is not correct. In general the B matrix is [Bf, Bw, Be] corresponding to feedback, noise, and exogenous (other deterministic) inputs. Refer to the 3rd bullet point in 'Details and Options' in the ref page for LQGRegulator. $\endgroup$ – Suba Thomas Mar 20 '13 at 13:32
  • $\begingroup$ I also think the dimensions of v is incorrect. In LQGRegulator you specify that only the first output is noisy but v has dimensions 2x2. $\endgroup$ – Suba Thomas Mar 20 '13 at 14:03
  • $\begingroup$ Thanks Suba, I've changed the dimensions of v. $\endgroup$ – Gerrit Apr 4 '13 at 14:33
4
$\begingroup$

If the noise and the input $u(t)$ enter the system in the same way you can simply use

ssm = SystemsModelExtract[ssm, {1, 1}]

before calling LQGRegulator

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thanks Bob, that seems to work well. If I understand correctly, when noise and input u (t) enter the system in the same way, {1,1} "doubles" the input, to satisfy the requirement of k = LQGRegulator[{ssm1, 1, 1}, {w, v}, {q, r}] having one noisy measurement and one input? $\endgroup$ – Gerrit Apr 4 '13 at 14:31
  • $\begingroup$ @Gerrit, your are right that the input gets "doubled". In general, for the specification SystemsModelExtract[sys, spec, ...], there would be n independent input channels of input i in the resulting system, where n = Count[spec, i]. So here {1, 1} would create a determinsitic feedback input and a noisy input. Just to clarify, both are inputs to the system. $\endgroup$ – Suba Thomas Apr 4 '13 at 20:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.