{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

recurDet

# recurDet - You may use itteration to go across a row but...

This preview shows page 1. Sign up to view the full content.

Sheet1 Page 1 %========================================================================== % Problem 2. Finding the determinant of a matrix using recursion %-------------------------------------------------------------------------- % % Problem Statement: % % Write a function called recurDet which takes in a square matrix and % returns the determinant of that matrix using recursion. % % Hint: Use the method of expansion by minors.
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: You may use itteration % to go across a row, but you must use recursion to actually find the % determinants. % http://mathworld.wolfram.com/DeterminantExpansionbyMinors.html % % Notes: % -You *must* use recursion to solve this problem. % function ans = recurDet(A) [r c] = size(A) ans = 0 minorsigns = 1 for i=1:r j=1:r j(i)= ans = ans + minorsigns.*A(i,1).*det(A(j,2:r)) minorsigns = -minorsigns end end...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online