Computes the 3X3 skew symetric matix S based on a 3D vector V such that S(V) represent the cross product operator: S(V)W=V*W Only the 3 coefficients of V count, it doesn't matter whether it is a row or column vector.
0001 function S = skew(Vector) 0002 % Computes the 3X3 skew symetric matix S based on a 3D vector V 0003 % such that S(V) represent the cross product operator: S(V)W=V*W 0004 % Only the 3 coefficients of V count, it doesn't matter whether it is a row 0005 % or column vector. 0006 0007 sizeV = size(Vector); 0008 if (sum(sizeV)==4 && ( ( sizeV(1)==1 && sizeV(2)==3 ) || ( sizeV(2)==1 && sizeV(1)==3 ) ) ) 0009 S = [ 0 -Vector(3) Vector(2) ;... 0010 Vector(3) 0 -Vector(1) ;... 0011 -Vector(2) Vector(1) 0 ]; 0012 else 0013 display('the input vector for cross product is:'); 0014 display(Vector); 0015 error('Vector for cross product is not a 3*1 nor a 1*3 matrix (see line above)!'); 0016 end 0017 end