Skip to content
Snippets Groups Projects
Commit 97c78802 authored by Sylvain CALINON's avatar Sylvain CALINON
Browse files

LQT_LS refined

parent c3cfc7dd
No related branches found
No related tags found
No related merge requests found
...@@ -79,7 +79,10 @@ for n=1:2 ...@@ -79,7 +79,10 @@ for n=1:2
x = x + xn; %Simulated noise on the state x = x + xn; %Simulated noise on the state
end end
Ka = (B' * P(:,:,t) * B + Ra) \ B' * P(:,:,t) * A; %Feedback gain 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 x = A * x + B * u; %Update of state vector
r(n).x(:,t) = x; %Log data r(n).x(:,t) = x; %Log data
end end
......
...@@ -97,9 +97,9 @@ for n=1:2 ...@@ -97,9 +97,9 @@ for n=1:2
if t==25 && n==2 if t==25 && n==2
x = x + xn; %Simulated noise on the state x = x + xn; %Simulated noise on the state
end end
% u = -Ka(:,:,t) * x; %Feedback control on augmented state (resulting in feedforward part and feedback 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_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 = 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 x = A * x + B * u; %Update of state vector
r(n).x(:,t) = x; %Log data r(n).x(:,t) = x; %Log data
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment