Find minimum and maximum for each row, MATLAB in Mathematics

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.

Posted Date: 10/22/2012 6:56:35 AM | Location : United States







Related Discussions:- Find minimum and maximum for each row, Assignment Help, Ask Question on Find minimum and maximum for each row, Get Answer, Expert's Help, Find minimum and maximum for each row Discussions

Write discussion on Find minimum and maximum for each row
Your posts are moderated
Related Questions
Three-dimensional pie and bar: For the bar3 function, x & y vectors are passed and the function displays three-dimensional bars as shown in figure: Figure: Three-dimen

Functions to create special matrices: The MATLAB also has various functions which create special matrices. For illustration, the zeros function generates a matrix of all zeros

Types of User-defined Functions: We know how to write a user-defined function, stored in an M-file, which computes and returns one value. This is merely one type of the functi

Built-in function for Differentiation: The MATLAB has a built-in function, diff that returns the differences between consecutive elements in a vector. For illustration, >>

Histogram: The histogram is a particular type of bar chart which shows the frequency of occurrence of the values within a vector. The Histograms use what are known as bins to

Give the formula for a rational function that has a hole at x=7 & vertical asmptote at x=-3/2

Nested IF-ELSE statements: The if-else statement is used to select between the two statements. In order to select from more than two statements, the if-else statements can als

Example of Minimum and Maximum Value For matrices, the functions min and max operate column wise by the default: >> mat = randint(2,4,[1 20]) mat =    9   10   1

Write a MATLAB function [d1, u1, l1, c1, r1] = NaiveGaussArrow(d, u, l, c, r) that takes as input the 5 vectors de ned above representing A. This function performs Naive Gauss redu

Script a MATLAB program which meets the following speci cations: The program expects an input of a two-variable real-valued continuous function f : R^2--> R The program is to cal