CHAPTER 2: CREATING ARRAYS Flashcards
What is an Array?
A fundamental form of MATLAB/OCTAVE uses to store and manipulate data.
Arranged in rows AND/OR columns
What is a one-dimensional array?
A row OR a column of numbers
What is a two-dimensional array?
Collection of numbers arranged in rows AND columns
What does one-dimensional array represent?
Vectors
What does two-dimensional array represent?
Matrices
How to create a row vector?
type elements with a space or comma in between (inside a bracket)
How to create a column vector?
type elements with a semicoln in between them
Purpose of linspace command
For creating a vector with linear (equal) spacing by specifying the first term, the spacing, and
the last term
Purpose of zeros (m,n) and ones (m,n) command
creates matrix with m rows and n columns in which all elements are 0 and 1, respectively
eye (n)
creates square matrix in which DIAGONAL elements are equal to 1 and the rest of elements are 0
What is a scalar
an array with one element
What is a transpose operator?
Switches a row (column) vector to a column (row) vector
Just type a quote “ ‘ “
Purpose of array addressing
Useful when there is a need to redefine only some of the elements