Hey guys,
I've got some issues with MATLAB. My task is to write a function that computes the the determinant of an n x n ( n=1,...,3 ) matrix, without using the det() command.
The problem is that I have no idea how to make a function. Here's what I have, this works fine in case of a 3x3 matrix. Still, it's not a function:
B is the determinant, A is the matrix and its elements in the brakets. It worked fine, checked it and got the same result with the det() command.
I've got some issues with MATLAB. My task is to write a function that computes the the determinant of an n x n ( n=1,...,3 ) matrix, without using the det() command.
The problem is that I have no idea how to make a function. Here's what I have, this works fine in case of a 3x3 matrix. Still, it's not a function:
B = (A(1,1) * A(2,2) * A(3,3)) - (A(1,1) * A(3,2) * A(2,3)) - (A(2,1) * A(1,2) * A(3,3)) + (A(2,1) * A(3,2) * A(1,3)) + (A(3,1) * A(1,2) * A(2,3)) - (A(3,1) * A(2,2) * A(1,3))
B is the determinant, A is the matrix and its elements in the brakets. It worked fine, checked it and got the same result with the det() command.