See other catalogues for
The MathWorks
You may also be interested in
Text version of the page
| | | | | | | | | | | | | |
| | | |
| | | 1 Matrices and Arrays | | |
| | | |
| | | | | | | | | | Function | Description | | | | zeros | Create a matrix or array of all zeros. | | | | eye | Create a matrix with ones on the diagonal and zeros elsewhere. | | | | accumarray | Distribute elements of an input matrix to specified locations in an output matrix, also allowing for accumulation. | | | | diag | Create a diagonal matrix from a vector. | | | | magic | Create a square matrix with rows, columns, and diagonals thatadduptothesamenumber. | | | | rand | Create a matrix or array of uniformly distributed random numbers. | | | | randn | Create a matrix or array of normally distributed random numbers and arrays. | | | | randperm | Create a vector (1-by-n matrix) containing a random permutation of the specified integers. | | | | | | | | | |
| | | |
| | | Most of these functions return matrices of type double (double-precision floating point). However, you can easily build basic arrays of any numeric type using the ones, zeros,and eye functions. To do this, specify the MATLAB class name as the last argument: A = zeros(4, 6, 'uint32') A= 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | | |
| | | |
| | | Examples Here are some examples of how you can use these functions. | | |
| | | |
| | | 1-6 | | |
| | | |
| | | | | | | | | | | | | |