A scalar is a (1 × 1) matrix containing a single element only. A column vector is a (m × 1) matrix that has m number of rows but a single column only. A row vector is a (1 × n) matrix which has n number of columns and has only one row.

All the elements of a row vector are separated by blank spaces or commas and are enclosed in square brackets.

For example, a row vector `q` = [1 2 4] can be entered at the Command Window as follows:

q = [1 2 4]; | |

or | q = [1,2,4] |

All the elements of a column vector are separated by semicolons and are enclosed in square brackets. For example, a column vector `q` is entered, as follows:

q = [1; 2; 4];

Variable q is a column vector and has one ...

Start Free Trial

No credit card required