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
Writing and Reading Spreadsheet Files: The MATLAB functions xlswrite & xlsread will write to and read from the spreadsheet files which have the extension .xls. For illustratio

Illustration of Labels and prompts: The program below prompts the user for endpoints (x1, y1) and (x2, y2) of a line segment, and computes the midpoint of the line segment, th

Strings as matrix: The matrix can be generated, that consists of strings in each row. Therefore, essentially it is created as a column vector of strings, but the final result

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

Applications of Customized Strings: Labels, Prompts, Arguments to Functions: The one of very useful application of this is to involve numbers in strings that are used to plot

Three-Dimensional Plots: The MATLAB has many functions which will display three-dimensional plots. Most of these functions have similar name as corresponding two-dimensional p

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

Customizing Plots : There are numerous ways to customize figures in the Figure Window. On clicking the Plot Tools icon will bring up the Property Editor & Plot Browser, with ma

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, >>

Illustrations of Variable number of output arguments: In the illustrations shown here, the user should actually know the type of the argument in order to establish how many va