Changing dimensions, MATLAB in Mathematics

Changing Dimensions:

In addition to transpose operator, the MATLAB has some built-in functions which change the dimensions or configuration of matrices, involving fliplr, reshape, flipud, and rot90.

The function reshape changes the dimensions of a matrix. The matrix variable below mat is 3   4, or in another words it has 12 elements.

>> mat = randint(3,4,[1 100])

mat =

14 61  2 94

21 28 75 47

20 20 45 42

These 12 values rather than it could be arranged as a 2   6 matrix, 6   2, 4   3, 1 12, & 12   1. The function reshape iterates throughout the matrix column wise. For illustration, whenever reshaping mat into a 2   6 matrix, the value from the first column in the original matrix (14, 21, and 20) are used first, then the values from the second column (61, 28, 20), and so on.

>> reshape(mat,2,6)

ans =

14 20 28  2 45 47

21 61 20 75 94 42

Posted Date: 10/18/2012 4:30:35 AM | Location : United States







Related Discussions:- Changing dimensions, Assignment Help, Ask Question on Changing dimensions, Get Answer, Expert's Help, Changing dimensions Discussions

Write discussion on Changing dimensions
Your posts are moderated
Related Questions
Changing Dimensions: In addition to transpose operator, the MATLAB has some built-in functions which change the dimensions or configuration of matrices, involving fliplr, resh

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

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

Strcat function - Concatenation : The strcat function, though, will eliminate the trailing blanks from strings before concatenating. Note that in these illustrations, the trail

Indexed empty matrix: The Individual elements cannot be eliminated from matrices, as matrices always have the similar number of elements in every row. >> mat = [7 9 8; 4 6

Illustration of Variance For illustration, for the vector [4, 6, 1, 5], there are n = 4 values therefore n - 1 is 3. The mean of this data set is also 4. The variance will be

Illustration of Minimum and Maximum Value Both of these functions also return the index of the minimum or maximum value; when there is more than one occurrence, it returns the

Error-checking for integers: illustrations of running this script as shown below: >> readoneint Enter an integer: 9.5 Invalid! Enter an integer: 3.6 Invalid

Illustration of Writing to files: Here is the other illustration in which a matrix is written to a file. At First, an arbitrary 2 × 4 matrix is generated, and then it is writt

Referring to and Modifying the Matrix Elements: To refer to matrix elements, the row and then the column indices are given in parentheses (always the row index initially and t