rot90 diag rotate matrix by 90 degrees create or extract diagonals 1 3 6 9 diag(A) 5 rot90(A) 2 5 8 9 1 4 7 trace det sum of diagonal elements determinant trace(A) 15 det(A) 0 tril triu extract lower triangular part extract upper triangular part 1 0 0 1 2 3 tril(A) 4 5 0 triu(A) 0 5 6 7 8 9 0 0 9 fliplr flipup flip matrix in the left right flip matrix in the up down direction – – direction 7 8 9 flipup(A) 4 5 6 3 2 1 1 2 3 fliplr(A) 6 5 4 9 8 7 flipdim norm flip matrix along specified dimension matrix or vector norm norm(x) gives Euclidean length 7 8 9 flipdim(A,1) 4 5 6 x = [0 1 2 3] 1 2 3 norm(x) sqrt(0+1+4+9) 3 2 1 = 3.7417 flipdim(A,2) 6 5 4 9 8 7 Find Find indices of nonzero elements. the indices of the vector that are non-zero. I = FIND(X) X the indices of where is greater than 100. I = FIND(A>100) A A row and column indices of the nonzero entries in matrix [I,J] = FIND(X) X. vector containing the nonzero entries in [I,J,V] = FIND(X) X. Note that and will produce the same and but the latter will find(X) find(X~=0) I J,
rot90 rotate matrix by 90 degrees 3 6 9 rot90(A) 2 5 8 1 4 7 diag create or extract diagonals 1 diag(A) 5 9 trace sum of diagonal elements trace(A) 15 det determinant det(A) 0 tril extract lower triangular part 1 0 0 tril(A) 4 5 0 7 8 9 triu extract upper triangular part 1 2 3 triu(A) 0 5 6 0 0 9 fliplr flip matrix in the left – right direction 3 2 1 fliplr(A) 6 5 4 9 8 7 flipup flip matrix in the up – down direction 7 8 9 flipup(A) 4 5 6 1 2 3 flipdim flip matrix along specified dimension 7 8 9 flipdim(A,1) 4 5 6 1 2 3 3 2 1 flipdim(A,2) 6 5 4 9 8 7 norm matrix or vector norm norm(x) gives Euclidean length x = [0 1 2 3] norm(x) sqrt(0+1+4+9) = 3.7417 Find Find indices of nonzero elements. I = FIND(X) the indices of the vector X that are non-zero. I = FIND(A>100) the indices of A where A is greater than 100. [I,J] = FIND(X) row and column indices of the nonzero entries in matrix X. [I,J,V] = FIND(X) vector containing the nonzero entries in X. Note that find(X) and find(X~=0) will produce the same I and J, but the latter will