from Eigenstructure assignment based residual generation by Hafiz Bilal Ahmad
A collection of m-files and simulink models for the generation of robust residuals.

prototype_eigstruct.m
% --------System Matrices---------%
A=[-1 0 1 0 1;1 -2 0 0 1;0 1 -3 1 0;0 0 1 -4 2;-1 -1 0 1 -5];
B=[1 0;0 1;0 0;0 0 ;1 0];
C=eye(5);
D=[1 0;0 1;0 0;0 0;0 0];

%---------Disturbance Matrix(Actual and modified)----------%
E=[0;1;0;1;0];
E1=[E B(:,1)];
G1=[0 0;0 1];
G2=[1 1 0 1 1;1 1 0 1 1 ;0 0 0 0 0;1 1 0 1 1;1 1 0 1 1];

%---------Eigen values and corresponding Eigenvectors-------%
[eigvec eigval]=eig(A);

%---------Calculation of Eigenstucture assignment based Observer gain 'K'-----% 
Q1=[-10*eye(5,5)-A' C'];
[S U V]=svd(Q1);
L1=V(:,6:10);
P1=L1(1:5,:);
T1=L1(6:10,:);
J1=[P1(1,:)+P1(5,:);P1(2,:)+P1(4,:)];
e1=inv(J1'*J1)*J1'*eigvec(2:3,1);
l1=P1*e1;
z1=T1*e1;
Q2=[-11*eye(5,5)-A' C'];
[S U V]=svd(Q2);
L2=V(:,6:10);
P2=L2(1:5,:);
T2=L2(6:10,:);
J2=[P2(1,:)+P2(5,:);P2(2,:)+P2(4,:)];
e2=inv(J2'*J2)*J2'*eigvec(3:4,2);
l2=P1*e2;
z2=T1*e2;
Q3=[-12*eye(5,5)-A' C'];
[S U V]=svd(Q3);
L3=V(:,6:10);
P3=L3(1:5,:);
T3=L3(6:10,:);
J3=[P3(1,:)+P3(5,:);P3(2,:)+P3(4,:)];
e3=inv(J3'*J3)*J3'*eigvec(4:5,3);
l3=P3*e3;
z3=T3*e3;
Q4=[-13*eye(5,5)-A' C'];
[S U V]=svd(Q4);
L4=V(:,6:10);
P4=L4(1:5,:);
T4=L4(6:10,:);
J4=[P4(1,:)+P4(5,:);P4(2,:)+P4(4,:)];
e4=inv(J4'*J4)*J4'*eigvec(1:2,4);
l4=P4*e4;
z4=T4*e4;
Q5=[-14*eye(5,5)-A' C'];
[S U V]=svd(Q5);
L5=V(:,6:10);
P5=L5(1:5,:);
T5=L5(6:10,:);
J5=[P5(1,:)+P5(5,:);P5(2,:)+P5(4,:)];
e5=[1;1;1;-inv(J5(:,[4,5]))*(J5(:,1)+J5(:,2)+J5(:,3))];
l5=P5*e5;
z5=T5*e5;
Z=[z1 z2 z3 z4 z5];
l=[l1 l2 l3 l4 l5];
K=(Z*inv(l))';
%---------Controller Gain---------%
W=l1';

Contact us at files@mathworks.com