function result = cramer(A,b) % Solve using cramer formula % determinant only need to be calculated ones detA = det(A); for i=1:size(A,1) result(i,1) = det(cramermatrix(A,i,b)) / detA; end