ABSTRACT
In Chapter 1 we covered some of the most basic aspects
of MATLAB® and Octave, and have seen how the software
can be used as a simple calculator to do arithmetics, as well
as performing operations using built-in functions. Nonethe-
less, both MATLAB and Octave are far more powerful than
that, and to unlock this power it is important to familiarise
ourselves with the objects that the software is able to manip-
ulate. In this chapter we will see how to deal with vectors
For the purposes of using MATLAB and Octave, we
can think of a vector as an arrangement of elements in a
column or a row. In that manner, vectors are effectively lists
of numbers for example, separated by either commas or
spaces. The number of entries is known as the “length” of
“elements”
into MATLAB and Octave we type the following in the
In the example above we have left a space between the first
could have done this explicitly with a comma, as shown in
We must be careful with the use of spaces as they can
change the number of elements in a vector and their value.