For small vectors or for creating novel, non-standard vectors, the direct method is the most flexible. For example, If you run out of room on a line when creating a vector, use the ellipsis (three dots, …) to continue typing on the next line. The power of using brackets comes mostly in creating larger vectors (and arrays) as catenations of smaller arrays. For example, the vectors a and b created above can be glued together horizontally to make a 6-element row vector Equispaced vectors have elements whose neighboring values are separated from each other by a fixed amount (the step size). The colon operator provides the fundamental method for creating such objects. For example Figuring out the step size such that the start and stop values are included in the result can be a tedious (but common) operation. The function linspace can help out here. The syntax is As an example, compare the result of the following expression to the version using the colon (above): linspace is helpful for creating vectors used for plotting and fitting data. For example, you might have a table of data such as logspace plays the role of linspace but on a logarithmic scale. Logarithmic spacing of elements in a vector is useful when dealing with exponential functions (log-log and semilog plots, in particular. The only difference between logspace and linspace to be aware of is in the definition of the starting and ending values. Being aware of this feature can eliminate a number of errors and frustrations in using this function. Sometimes you just need a vector of numbers to do something with. The functions rand and randn produce vectors (and arrays) of random numbers (see help for more information). For example, Normally distributed random numbers with mean mu and standard deviation sigma can be generated from randn via The functions ones and zeros do as advertized. Generally, ones can be used for copying a scalar into a vector as in zeros, on the other hand, is useful for initializing (pre-allocating) arrays. Pre-allocation of arrays usually help speed the execution of scripts and functions that involve loops that generate arrays. Source.