Matlab-Matrix - Determinant


Advertisements

Determinant of a matrix is calculated by using the det function of MATLAB. For example, the determinant of a matrix A is given by det(A).

Example

Consider following example for calculating the determinant of a matrix −

a = [ 1 2 3; 2 3 4; 1 2 5];
test = det(a)

Output

The code on execution in MATLAB is as follows −

>> a = [ 1 2 3; 2 3 4; 1 2 5];
test = det(a)

test =

   -2 
>>
Advertisements