Write a code in matlab to compute the determinant of a matrix by iteration. DO N
ID: 2259768 • Letter: W
Question
Write a code in matlab to compute the determinant of a matrix by iteration. DO NOT USE THE DETERMINANT FUNCTION OF MATLAB.
Explanation / Answer
matlab code:
A = [1 2 3;
4 5 6;
8 10 99];
[L, U, P] = lu(A)
prod = 1;
for i=1:size(A)
prod*= L(i,i)*U(i,i);
end
disp(prod);