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

12,153

Solution 1

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.

Solution 2

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.

Share:
12,153
Admin
Author by

Admin

Updated on June 09, 2022

Comments

  • Admin
    Admin almost 2 years

    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.