Home > bobstuff > cv.m

cv

PURPOSE ^

CV Cross product between two vectors.

SYNOPSIS ^

function y=cv(x1,x2)

DESCRIPTION ^

 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)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

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

Generated on Thu 01-Dec-2005 07:46:03 by m2html © 2003