The Colon Operator:
If the values in the vector are regularly spaced, the colon operator is used to iterate through these values. For illustration, 1:5 results in all the integers from 1 to 5:
>> vec = 1:5
vec =
1 2 3 4 5
Note that in this situation, the brackets [ ] are not essential to define the vector.
With the colon operator, a step value can also be identified with the other colon, in the form (first: step: last). For illustration, to generate a vector with all the integers from 1 to 9 in steps of 2:
>> nv = 1:2:9
nv =
1 3 5 7 9