Assmt 2
Assmt 2
% K is controller gain
K = [0 0 0 0; 0 0 0 0]; % Set to some initial value
% J_arr = zeros(1000, 1)
flag = 0;
A = A - B*K*C;
eval = max(real(eig(A))); % this is the condition for checking
asymptotic stability of the matrix A
1
% A matrix can only be stable if all of its eigenvalues are in
left
% plane
if(eval>=0)
if i == 1
J = trace(P*X); % J is the performance index
elseif i>1
trange = 0:0.01:10;
[t, x] = ode45(@(t, x) (A_init - B*K*C)*x, trange, x_0);
figure(1);
plot(t, x(:, 1)), legend('Sideslip')
figure(2);
plot(t, x(:, 2)), legend('Bank Angle')
figure(3);
plot(t, x(:, 3)), legend('Roll Rate')
figure(4);
plot(t, x(:, 4)), legend('Yaw Rate')
figure(5);
plot(t, x(:, 5)), legend('\delta_{a}')
figure(6);
plot(t, x(:, 6)), legend('\delta_{r}')
figure(7);
plot(t, x(:, 7)), legend('Washout Filter State')
2
The closed loop poles are
-0.4227 + 3.0634i
-0.4227 - 3.0634i
-3.6153 + 0.0000i
-1.0000 + 0.0000i
-0.0162 + 0.0000i
-20.2000 + 0.0000i
-20.1999 + 0.0000i
3
4
5
Published with MATLAB® R2020a