MATLAB: Vector multiplication for a vector with a transpose of vector i.e. one row vector and one column vector.

MATLABvector multiplication

I am using this script to multiply two vectors as below:
%Parameters Declaration
S0T=[1,2,3,-1,-2]
S1T=[1,1,-2,2,-3]
S0=transpose(S0T)
S1=transpose(S1T)
S1=S0T*S0
S2=S0T*S1
S3=S1T*S0
S4=S1T*S1
But unfortunately I am not able to match the output with theoretical results as below:
Output:
S0T =
1 2 3 -1 -2
S1T =
1 1 -2 2 -3
S0 =
1
2
3
-1
-2
S1 =
1
1
-2
2
-3
S1 =
19
S2 =
19 38 57 -19 -38
S3 =
1
S4 =
19 19 -38 38 -57
>>
Theoretical Results:
S1=19 (This is correct)
S2=1 (This is Wrong as per Matlab results)
S3=1 (This is correct)
S4=19 (This is Wrong as per Matlab results)
Question: I want to know if there is a better commend/operator in MATLAB that can be used to multiply two vectors i.e. one row vector and one column vector.

Best Answer

It's because you redefined S1 in line 6. Use distinct variable names for your outputs:
S0T=[1,2,3,-1,-2]
S1T=[1,1,-2,2,-3]
S0=transpose(S0T)
S1=transpose(S1T)
A=S0T*S0
B=S0T*S1
C=S1T*S0
D=S1T*S1
A =
19
B =
1
C =
1
D =
19