diff --git a/matlab/LQT_recursive.m b/matlab/LQT_recursive.m index e10ca113258e38242da06445a70a916f415385f1..c396f8230e10be81e32855872c58ca68dd28de1f 100644 --- a/matlab/LQT_recursive.m +++ b/matlab/LQT_recursive.m @@ -79,7 +79,10 @@ for n=1:2 x = x + xn; %Simulated noise on the state end Ka = (B' * P(:,:,t) * B + Ra) \ B' * P(:,:,t) * A; %Feedback gain - u = -Ka * x; %Feedback control on augmented state (resulting in feedback and feedforward terms on state) + u = -Ka * x; %Feedback control on augmented state (resulting in feedforward part and feedback on state) +% u_ff = -Ka(:,end); %Feedforward part on state +% u = u_ff - Ka(:,1:end-1) * x(1:end-1); %Feedforward and feedback part on state + x = A * x + B * u; %Update of state vector r(n).x(:,t) = x; %Log data end diff --git a/matlab/LQT_recursive_LS.m b/matlab/LQT_recursive_LS.m index 9cd3db86d44dcba203418d031b1c24daefb6e137..7a0c4379fe2b1b341da7f0c1960c3fb940dc217f 100644 --- a/matlab/LQT_recursive_LS.m +++ b/matlab/LQT_recursive_LS.m @@ -97,9 +97,9 @@ for n=1:2 if t==25 && n==2 x = x + xn; %Simulated noise on the state end -% u = -Ka(:,:,t) * x; %Feedback control on augmented state (resulting in feedforward part and feedback on state) - u_ff = -Ka(:,end,t); %Feedforward part on state - u = u_ff - Ka(:,1:end-1,t) * x(1:end-1); %Feedforward and feedback part on state + u = -Ka(:,:,t) * x; %Feedback control on augmented state (resulting in feedforward part and feedback on state) +% u_ff = -Ka(:,end,t); %Feedforward part on state +% u = u_ff - Ka(:,1:end-1,t) * x(1:end-1); %Feedforward and feedback part on state x = A * x + B * u; %Update of state vector r(n).x(:,t) = x; %Log data