find minimum and maximum for each rowto find the


Find Minimum and Maximum for each row

To find the maximum (or minimum) for each row, the dimension of 2 (that is how a MATLAB refers to rows) can be identified as the third argument to the max (or min) function; the second argument should be an empty vector:

>> min(mat,[],2)

ans =

   5

   9

Such functions can also compare vectors or matrices and return the maximum (or minimum) values from corresponding elements. For illustration, the below iterates through all elements in the two vectors, comparing equivalent elements and returning the minimum for each:

>> x = [3 5 8 2 11];

>> y = [2 6 4 5 10];

>> min(x,y)

ans =

2 5 4 2 10

A few of the other functions in the datafun help topic which have been explained already involve cumsum, sum, prod, cumprod, and hist.

Request for Solution File

Ask an Expert for Answer!!
Applications of MATLAB: find minimum and maximum for each rowto find the
Reference No:- TGS0175316

Expected delivery within 24 Hours