Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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.

Problem 2 (Computing the determinant of a matrix by iteration). Repeat the previous problem, but this time use an algorithm that computes the determinant by first reducing the matrix to triangular form as you do in a different context when doing Gaussian elimination. Then compute the determinant as the product of the diagonal entries of the triangular form. Produce the same table, and again state the largest n for which you can compute the determinant in (25 points) under one minute.

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);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote