function p6 %t2 t3 function t1 A= [1 1; 4 1]; disp_eig(A) A= [0 1; -1 -3]; disp_eig(A) A= [0 1; 1 0]; disp_eig(A) function disp_eig(A) [V,D]= eig(A); eigvalues= diag(D)' % make easy to read eigenvectors % enforce first coord of eigenvectors = 1 (NOT always possible!) V= V./repmat(V(1,:),2,1) % for my eyes: eig works very well; very small numeric errors have % always to exist as computers have high, but limited, precision! % B= (V)*D*inv(V); err= max(max(abs(B-A))) return function t2 %s= tf([1 0],1); syms s B= [s-1 1; 4 s-1]/((s-1)*(s-1)-4); %pretty(simplify(ilaplace(B))) pretty(ilaplace(B)) function t3 syms s lst= {[1 1; 4 1], [0 1; -1 -3], [0 1; 1 0]}; Vsav= []; Dsav= []; for i=1:length(lst) A= lst{i}; [V,D]= eig(A); Vsav= [Vsav V./repmat(V(1,:),2,1)]; Dsav= [Dsav [D(1,1); D(2,2)]]; pretty(ilaplace(inv(s*eye(2)-A))) end Dsav Vsav