MATLAB max

max( ) command or function gives the largest or maximum element of vector or matrix or array, after reading this MATLAB max topic, you will know the theory and examples.


Syntax:

max(n)

  • n can be any vector or matrix.

Example: To find the largest element of the vector.

Output:

n =

1 2 2 100 5 78

ans =

100

Example: To find the largest element of each column of the matrix.

Output:

n =

1   2   3
1   2   23
4   5   21

ans =

4  5  23

Explanation:

  • 4, 5 and 23 is the maximum element of the first, second and third column of the matrix respectively.

Leave a Comment

Your email address will not be published. Required fields are marked *

error: Content is protected !!
Scroll to Top