Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between a vector and a matrix in MATLAB?

I've seen the following statements in a help file:

xL = [-6 -6];
xU = [6 6];

I didn't understand whether xL and xU are vectors or matrices. Thank you.

like image 502
GiorkosOlan Avatar asked Nov 29 '22 17:11

GiorkosOlan


2 Answers

A vector is a 1-dimensional matrix, either a vertical vector (N × 1) or horizontal vector (1 × N). Vectors are a subclass of matrices, so every vector is a matrix. xL and xU are horizontal (1 × N) vectors and therefore they are also matrices.

like image 32
nrz Avatar answered Dec 04 '22 11:12

nrz


In MATLAB terminology, both vectors and matrices are arrays of numerical values.

Technically, a vector is a form of a matrix having one row or one column (read about isvector and ismatrix commands for more information).

Practically, however, matrices are usually referred to in the documentation as having at least 2 columns and 2 rows, so I would rather call xL and xU vectors.

like image 131
Eitan T Avatar answered Dec 04 '22 11:12

Eitan T