A=[3, 0; -3.5, -0.5]
B=[1, 1; 2, -2]
C=[1, -1]
D=[0, 0]
x0=[1; -2]

% evoluzione libera dello stato
[num_el,den_el]=ss2tf(A,x0,eye(size(A)),zeros(size(x0)),1)
[r1,p1,k1]=residue(num_el(1,:),den_el)
[r2,p2,k2]=residue(num_el(2,:),den_el)

% evoluzione libera dell'uscita
[num_el,den_el]=ss2tf(A,x0,C,zeros(size(C,1),1),1)
[r,p,k]=residue(num_el,den_el)

% evoluzione forzata dello stato
[num_xfp1,den_xfp1]=ss2tf(A,B,eye(size(A)),zeros(size(B)),1)
[num_xfp2,den_xfp2]=ss2tf(A,B,eye(size(A)),zeros(size(B)),2)
num_u1=2
den_u1=[1,-1]
num_u2=3
den_u2=[1, 0]
[r,p,k]=residue(conv(num_xfp1(1,:),num_u1),conv(den_xfp1,den_u1))
[r,p,k]=residue(conv(num_xfp1(2,:),num_u1),conv(den_xfp1,den_u1))
[r,p,k]=residue(conv(num_xfp2(1,:),num_u2),conv(den_xfp2,den_u2))
[r,p,k]=residue(conv(num_xfp2(2,:),num_u2),conv(den_xfp2,den_u2))

% evoluzione forzata dell'uscita
[num_m1,den_m1]=ss2tf(A,B,C,D,1)
[num_m2,den_m2]=ss2tf(A,B,C,D,2)
[r,p,k]=residue(conv(num_m1,num_u1),conv(den_m1,den_u1))
[r,p,k]=residue(conv(num_m2,num_u2),conv(den_m2,den_u2))