>> a=[1 2 3]
a =
1 2 3
>> a=[1;2;3] a = 1 2 3
>> n=0:5
n =
0 1 2 3 4 5
>> n^2
??? Error using = > ^
Matrix must be square.
>> n.^2
ans =
0 1 4 9 16 25
>> a=[1 2 3]
a =
1 2 3
>> b=[4;5;6]
b =
4
5
6
>> a*b
ans =
32
>> a'.*b
ans =
4
10
18
Since a is a row vector and b is a column vector, if you use a*b you will have performed a dot product. On the other had if you want to multiply every element in a by every element in b to generate a new vector, then you need to transpose one of the two vectors by using ' and then multiply the two vectors using .*.