A vector in MATLAB is a sequence of numbers. There are several ways to create vectors; one of the most common is to put a sequence of numbers in square brackets:
>> [1 2 3] ans = 1 2 3
Another way to create a vector is the colon operator, which we have already used to create a range of values in a
>> 1:3 ans = 1 2 3
In general, anything you can do with a number, you can also do with a vector. For example, you can assign a vector value to a variable:
>> X = [1 2 3] X = 1 2 3
Note that variables that contain vectors are often capital letters. That’s just a convention; MATLAB doesn’t require it, but it’s a useful way to remember which variables are vectors.