Usage of max in MATLAB

Source: Internet
Author: User

C = max (A)

Returns the largest element in a different dimension of an array.
If a is a vector, Max (a) returns the largest element in a.
If A is a matrix, Max (a) takes each column of a as a vector, and returns a row of vectors containing the largest element of each column.

C = Max (A, B)

Returns an array of the same size as a and B, where the element is the largest element taken out of a or B.

When AMXN is a matrix, there are several situations:
A = Fix (rand (5,3) *50)% generates 5x3 random matrix
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
[C,i]=max (a,[],1)% function is the same as [U V] = max (A)
[C,i]=max (a,[],2)%%c for row and column extremum, I number

A = fix (rand (5,3) *50)% generates random 5x3 matrix B = a;% Matrix backup once C = Max (max (A))% Matrix maximum d = max (a,[],1)% per column maximum, get row vector e = max (a,[],2)% per row, get column vector F = max (a,8)% less than 8 is replaced with 8[u V] = max (a)%u is the column extremum, V is line number h = max (a)% function with DI = max (A (:))% function with CJ = MAX (A (:,:))% function with D [C,i]=max (a,[],1)% function Same as [U V] = max (A) [C,i]=max (a,[],2)%%c is a row and column extremum, i row number A =     5     6     5     6     4    25C = 43D = 6 (    43)    25F =     8     8     8     8    24     8    25U =    35V =     1     4     3H = A.    35I =    43J =    41    35c =    35i =     1     4     3c =    6 +    25i =     1     1     1)     2     3

  

Usage of max 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.