- the maximum of 1 and 10 is 10
- the maximum of 3 and 6 is 6
- the maximum of 5 and 4 is 5
Doubt regarding max(A,B).
5 views (last 30 days)
Stephen23 on 21 Aug 2021
Edited: Stephen23 on 21 Aug 2021
"Why is max(A,B) as [10 6 5]?"
Because that syntax provides an element-wise comparison of the two input arrays, taking the maximum value from either one of the input arrays:
"It should be [5 10]"
No, it should not be.
What are are expecting is the maximum of each row of one matrix (not comparing the elements of two different arrays):
Note that in some other languages the two functionalities are considered as different functions, e.g. in numpy they are amax and maximum respectively.