%% Find RREF of augmented matrix (A|b)

A = sym([1,2,3;4,5,6;7,8,9])
b = sym([10;11;12])
Ab = horzcat(A,b)
rref(Ab)

%
%% Find eigenvalues and eigenvectors symbolically

[vA,eAt] = eig(A)
eA = diag(eAt)
l2A = eA(2)
v2A = vA(:,2)

%
%% Find eigenvalues and eigenvectors numerically

[vAn,eAnt] = eig(vpa(A))
eAn = diag(eAnt)
l3An = eAn(1)
v3An = vAn(:,1)

%
%% Find eigenvalues and eigenvectors, and scale eigenvector to have sum 1

B = sym([1/10,2/10,3/10;4/10,5/10,6/10;5/10,3/10,1/10])
[vB,eBt] = eig(B);
eB = diag(eBt)
l3B = eB(3);
v3B = vB(:,3);
v3Bs = v3B/sum(v3B)
vpa(v3Bs,12)