The usage and meaning of max function in MATLAB

Source: Internet
Author: User

When a is a column vector, returns a maximum value, which is not mentioned here.

When AMXN is a matrix, there are several situations:

①c = Max (max (A)), returns the maximum value of the matrix

②d = max (a,[],1), returns the maximum value of each row, which is the line vector of MX1

③e = max (a,[],2), returns the maximum value of each column, which is the 1XM column vector

④f = max (a,8), filled with 8 when the element is less than 8

⑤[u V] = max (A), returns the row and column number of the largest element of a row

Note the following expressions:

H = max (A)

I = Max (A (:))

J = Max (A (:,:))

The programming experiment is as follows:

A = Fix (rand (5,3) *50)%

B = a;% Matrix backup once

C = Max (max (A))% matrix maximum

D = max (a,[],1)% of the maximum value of each column to get the row vector

E = max (a,[],2)% of the maximum value of each row, get the column vector

F = max (a,8)% less than 8 is replaced with 8

[U V] = max (A)%u is the column extremum and V is the line number

H = max (A)% function with D

I = Max (A (:))% function with C

J = Max (A (:,:))% function with D

Result output:

A =

37 47 42

12 27 12

25 8 40

34 8 12

44 12 46

C = 47

D = 44 47 46

E =

47

27

40

34

46

F =

37 47 42

12 27 12

25 6 40

34 7 12

44 12 46

U = 44 47 46

V = 5 1 5

H = 44 47 46

I = 47

J = 44 47 46

Reprint: http://blog.sina.com.cn/s/blog_7da9e4aa0101bumt.html

The usage and meaning of max function in MATLAB

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.