Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
1  
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. –  Suba Thomas Mar 19 '13 at 18:46
    
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)$ –  Gerrit Mar 20 '13 at 9:16
    
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. –  Suba Thomas Mar 20 '13 at 13:32
    
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. –  Suba Thomas Mar 20 '13 at 14:03
    
Thanks Suba, I've changed the dimensions of v. –  Gerrit Apr 4 '13 at 14:33
add comment

1 Answer 1

up vote 2 down vote accepted

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

share|improve this answer
    
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? –  Gerrit Apr 4 '13 at 14:31
    
@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. –  Suba Thomas Apr 4 '13 at 20:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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