ts = 50; % Total simulation time (s) Tc = 0.1; % Sampling time (s) r = 1; % 1 input A = [0.9944 -0.1203 -0.4302; 0.0017 0.9902 -0.0747; 0 0.8187 0]; B = [0.4252 -0.0082 0.1813]'; C = eye(3); % m = 3 outputs D = zeros(3,1); % zeros(m,r) r = 1, (1 input) x0 = [0.05 0.15 0.2]; c1 = C(1,:); % 1st row of C c2 = C(2,:); % 2nd row of C c3 = C(3,:); % 3rd row of C v = [0.86 0.87 0.88]; % Observer eigenvalues: % they are the same for all % observers, but they can be % also different tf1 = ts/2; % Fault starting time tf2 = ts/2; tf3 = ts/2; % % Observability condition verification % the observability matrix needs to have rank = 3 % % rank(obsv(A,c1)) == 3 % rank(obsv(A,c2)) == 3 % rank(obsv(A,c3)) == 3 % K1 = place(A',C(1,:)',v)'; % It computes the gain so that % the matrix A-Ki*Ci has eigenvalues = to v K2 = place(A',C(2,:)',v)'; K3 = place(A',C(3,:)',v)'; Ao1 = A - K1*c1; Bo1 = [B K1]; Co1 = c1; Do1 = zeros(1,r+1); Ao2 = A - K2*c2; Bo2 = [B K2]; Co2 = c2; Do2 = zeros(1,r+1); Ao3 = A - K3*c3; Bo3 = [B K3]; Co3 = c3; Do3 = zeros(1,r+1); return