Next Post:

Addition Of Diagonal Elements Of A Matrix In MatLab®(Illustrated Expression)

Indexing Maximum And Minimum Values In MatLab®(Illustrated Expression)

In some cases, you need to the used maximum or minimum values of number series in mathematical calculations or data analyses in Matlab®. Matlab® provides a very useful command to index the maximum and minimum values of vectors and matrices inside it. In this article, we will show you how to index maximum and minimum values of matrices and vectors in Matlab®.

How To Index Maximum And Minimum Values Of Matrices And Vectors In Matlab®?

>> a = [263 62 626; 65 56 562; 5412 12621 26];
b = [263 62 626; 65 56 562; 5412 12621 26];
min(a)
max(a)
min(b)
max(b)

ans =

    65    56    26


ans =

        5412       12621         626


ans =

    65    56    26


ans =

        5412       12621         626

>> 

We created the ‘a’ and ‘b’ vector and matrix as shown above to show you how to use max() and min() commands in Matlab®. Also, we calculated the maximum and minimum values of their matrix and vector as shown above.

As you can see that the maximum and minimum values of vector ‘a’ are calculated respectively.

Also, maximum and minimum values are calculated matrix ‘b’ respectively as shown above. As you can see the maximum and minimum value of each row of matrix ‘b’ is calculated with max() and min() commands in Matlab®.

Conclusion

Calculations of maximum and minimum values of vectors or matrices in Matlab® are very basic as you can see.

Do not forget to leave your comments and questions below about the use of the max() and min() commands in Matlab® below. 

If you want further coding examples about the max() and min() commands in Matlab®, inform us in the comments.

This article is prepared for completely educative and informative purposes. Images used courtesy of Matlab®

Your precious feedbacks are very important to us.

  • Site Comments

At least 10 characters required.