MATLAB Programming/Vector and Matrices

Scalar
Scalars are the physical quantities that are described by magnitude only. In other words, scalars are those quantities that are represented just by their numerical value, such as 3, -5, 0.368, etc.

Vector
A vector is an array of numbers or a list of scalar values in one dimensional array of numbers (can be in a row or column).

This example vector A below is row vector
 * $$\mathbf{A} = \begin{bmatrix}

5 & 8 & 6 \\ \end{bmatrix}.$$

This example vector B below is column vector
 * $$\mathbf{B} = \begin{bmatrix}

7 \\ 3 \\ 2 \end{bmatrix}.$$

Matrix
A matrix is an ordered rectangular array arrangement of numbers. They are stored as two-dimensional arrays in MATLAB. A matrix having m rows and n columns is called a matrix of order m × n or simply m × n matrix. It can be represented by one or more rows (i) AND one or more columns (j).

Back in Introduction chapter, MATLAB was originally designed to carry out operations with matrices, and received the name of MATrix LABoratory that subsequently was reduced to MATLAB.

It is possible to find applications of matrices not only in the mathematics areas, but also in a great deal of applications in engineering, in physics, in finance, in accounting, in chemistry and in biology, perhaps more.

There are many types of matrices with followings as shown

Scalar in MATLAB
Scalar in MATLAB looks like assigning a variable to a number such as followed:

a = 6

Vectors in MATLAB
You can type following in MATLAB

For row vector, just type comma "," to separate each number For column vector, just type semicolon ";" to separate each number

Matrix in MATLAB
In MATLAB, to create matrix (or matrices), there is 3 important operator to be used

(a) Bracket "[" "]" as container for the matrix (b) Comma , as matrix row separator (c) Semicolon ; as matrix column separator

For example, we are creating 4X3 matrix in MATLAB using following commands.