In MATLAB, all single-character operators are matrix operators. So, you are using the matrix power, e.g.,
a^2 == a*a
if you want to square each element, you'll have to use the element-wise power operator:
>> a.^2
ans =
1 4
9 16
Read more about MATLAB's operators here.