Changing dimensions, MATLAB in Mathematics

Assignment Help:

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


Related Discussions:- Changing dimensions

Strings as matrix, Strings as matrix: The matrix can be generated, tha...

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

Empty vectors, Empty Vectors: An empty vector or in another words, a v...

Empty Vectors: An empty vector or in another words, a vector which stores no values, can be generated using the empty square brackets: >> evec = [] evec = [] >> lengt

Concatenation, Concatenation: The String concatenation means to join t...

Concatenation: The String concatenation means to join the strings altogether. Of course, as strings are merely vectors of the characters, the technique of concatenating vector

Error-checking for integers, Error-Checking for Integers: As MATLAB us...

Error-Checking for Integers: As MATLAB uses the type double by default for all the values, to check to make confirm that the user has entered an integer, the program have to c

Function xlsread - file function, Function xlsread - file function: Th...

Function xlsread - file function: The function xlsread will read from the spreadsheet file. For illustration, to read from file just generated: >> ssnums = xlsread('ranexc

Illustration of empty vectors , Illustration of Empty vectors: The Emp...

Illustration of Empty vectors: The Empty vectors can also be used to delete elements from the arrays. For illustration, to remove the third element from array, an empty vector

Example of minimum and maximum value, Example of Minimum and Maximum Value ...

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

Illustration of advanced file input and output, Illustration of Advanced fi...

Illustration of Advanced file input and output: For illustration, to refer to the third number in the first element of the cell array: >> subjdata{1}(3) ans =

Writing variables to a file, Writing variables to a File: The save com...

Writing variables to a File: The save command is used to write variables to a file, or to append the variables to a MAT-file. By the default, save function writes to a MAT-fil

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd