A vector is a sequence of numbers. Vectors will be particularly important to us because that is how sound is represented, as a sequence of numbers. Try the following to see how the comma and semicolon change the output:
>> x = [1 3 7 15] >> x = [1, 3, 7, 15] >> x = [1; 3; 7; 15] >> x'
In the last example, we see the transpose operator. We will see this more later, but for now you can use this to turn row vectors into column vectors and vice versa.
Some other useful ways to create vectors:
>> 1:5 >> z = 1:1/2:5 >> ones(1, 5) >> zeros(1, 5)
You can determine the length and size of a vector using the following commands:
>>length(x) >>size(x)
Accessing values within a vector:
>> x(3) >> x(1:3) >> x(find(x==7))
You can concatenate two (or more) vectors as follows:
>> z = [1:3, 4:6]