Matlab-Matrix - Rank



The rank of the matrix is the number of linearly independent columns in a matrix. The function rank() helps to return the rank of a given matrix.

Example

Consider following example for the use of rank() function for a matrix −

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

Output

The output in MATLAB on execution of the code is as follows −

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

a =

   1  2  3
   2  3  4
   1  2  5
 
test =

   3
 
>>
Advertisements