From: andrea on 7 Jul 2010 06:10 Hi, I have a vector, V, and an array, A. Which function in MATLAB running the cross product between a vector and an array? I saw the function cross but its in input accept two vectors with equal size. Thanks for all Andrea
From: James Tursa on 7 Jul 2010 06:21 "andrea " <nacchio1983(a)yahoo.it> wrote in message <i11jpt$pho$1(a)fred.mathworks.com>... > > I have a vector, V, and an array, A. > Which function in MATLAB running the cross product between a vector and an array? > I saw the function cross but its in input accept two vectors with equal size. Do you mean something like this, column by column? bsxfun(@cross,V,A) James Tursa
From: Matt J on 7 Jul 2010 08:41 "andrea " <nacchio1983(a)yahoo.it> wrote in message <i11jpt$pho$1(a)fred.mathworks.com>... > Hi, > > I have a vector, V, and an array, A. > Which function in MATLAB running the cross product between a vector and an array? > I saw the function cross but its in input accept two vectors with equal size. You could also do as follows xprodmat(V)*A; %Column-by-column cross product of V with A function A=xprodmat(a) %Matrix representation of a cross product % % A=xprodmat(a) % %in: % % a: 3D vector % %out: % % A: a matrix such that A*b=cross(a,b) if length(a)<3, error 'Input must be a vector of length 3'; end ax=a(1); ay=a(2); az=a(3); A=zeros(3); A(2,1)=az; A(1,2)=-az; A(3,1)=-ay; A(1,3)=ay; A(3,2)=ax; A(2,3)=-ax;
|
Pages: 1 Prev: summing x-y data files using matlab Next: inverse continuous wavelet transform |