Functions FKinSpace and FKinBody give the following message when executed in Octave:
warning: colon arguments should be scalars.
This is due to the fact that function size returns a vector containing the number of rows and number of columns. Not sure under MATLAB. I believe the following should be used:
for i = 1: size(thetalist)(1)
if thetalist is a column vector, instead of:
for i = 1: size(thetalist)