


CV Cross product between two vectors. y=CV(x1,x2) computes cross product between x1 and x2 with means removed. Assumes x1,x2 are separate vectors. For use in VECCOR1. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ver. 1: 11/17/96 (RB) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


0001 function y=cv(x1,x2) 0002 0003 % CV Cross product between two vectors. 0004 % 0005 % y=CV(x1,x2) computes cross product between x1 and x2 with means 0006 % removed. Assumes x1,x2 are separate vectors. For use in VECCOR1. 0007 % 0008 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0009 % ver. 1: 11/17/96 (RB) 0010 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0011 0012 x1m=mean(x1); 0013 x2m=mean(x2); 0014 x1p=x1-x1m; 0015 x2p=x2-x2m; 0016 [N,M]=size(x1); 0017 if N==1 0018 y=x1p*x2p'; y=y./(M-1); 0019 elseif M==1 0020 y=x1p'*x2p; y=y./(N-1); 0021 end 0022 end