small tweaks

This commit is contained in:
Enrico Lumetti 2021-08-29 18:41:40 +02:00
parent b2f4137d08
commit 353456519a
1 changed files with 5 additions and 5 deletions

View File

@ -26,7 +26,7 @@ G_fullstate = uss(A, B, eye(4), zeros(4, 2));
w = logspace(0, 3, 40);
systems = usample(G, 40);
data = frd(systems, w) ;
[G2, Info] = ucover(data, G.NominalValue, 4, []);
[~, Info] = ucover(data, G.NominalValue, 4, []);
Im = tf(Info.W1);
%% Controller Definition
@ -63,14 +63,14 @@ Ws = (s/Ms + omega_b)/(s+omega_b*eps_s);
% state weight + integrators weight
Q = blkdiag(1e3*eye(4), 1e7*eye(2));
% input weight
R = 1e-8*eye(2);
K = -lqi(Gn, Q, R, zeros(6, 2));
R = 1e-3*eye(2);
K = lqi(Gn, Q, R, zeros(6, 2));
K = ss(K);
K.InputName = {'x(1)', 'x(2)', 'x(3)', 'x(4)', 'e(1)', 'e(2)'};
K.OutputName = 'u';
G_fullstate.InputName = 'u';
G_fullstate.OutputName = 'x';
G_feedback = connect(G_fullstate, K, 'e', 'x', 'u');
G_feedback = connect(G_fullstate, -K, 'e', 'x', {'u', 'x'});
% only select first and second output
G_feedback = G_feedback([1 2], [1 2]);
G_feedback.OutputName = 'y';
@ -156,7 +156,7 @@ title('Multiplicative Uncertainty Magnitude');
%% Simulation
t = 0:0.001:3;
r1 = 0*t + 1;
r1 = 0*t + 0.1; % 10 centimeters displacement
r2 = 0*t;
% transfer function from reference to controller output