165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
J_ux = J_ux + (QQ .* y_u(:,i:n_y:n_yu)') * y_x(:,i:n_y:n_yx);
QQ = ones(n_x,1)*Q(i,:); # Resize Q
J_xx = J_xx + (QQ .* y_x(:,i:n_y:n_yx)') * y_x(:,i:n_y:n_yx);
endfor
## Input weighting (scalar for the moment)
if (n_u>1)
warning("Sorry, cant do n_u>1 just now");
endif
## Scale R
R = R*dt; # Scale to give correct units
for i = 1:m_t
Ust = Us(i,:);
J_uu = J_uu + Ust'*R*Ust;
|
|
>
|
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
J_ux = J_ux + (QQ .* y_u(:,i:n_y:n_yu)') * y_x(:,i:n_y:n_yx);
QQ = ones(n_x,1)*Q(i,:); # Resize Q
J_xx = J_xx + (QQ .* y_x(:,i:n_y:n_yx)') * y_x(:,i:n_y:n_yx);
endfor
## Input weighting (scalar for the moment)
if (n_u>1)
warning("Sorry, cant do n_u>1 just now: exiting");
return
endif
## Scale R
R = R*dt; # Scale to give correct units
for i = 1:m_t
Ust = Us(i,:);
J_uu = J_uu + Ust'*R*Ust;
|