annotate private/EDB1cross.m @ 18:2d5f50205527 jabuilder_int tip

Escape the trailing backslash as well
author Chris Cannam
date Tue, 30 Sep 2014 16:23:00 +0100
parents 90220f7249fc
children
rev   line source
tp@0 1 function c = EDB1cross(a,b)
tp@0 2 % EDB1cross - Stripped down version of Matlab's built in function cross.
tp@0 3 %
tp@0 4 % ----------------------------------------------------------------------------------------------
tp@0 5 % This file is part of the Edge Diffraction Toolbox by Peter Svensson.
tp@0 6 %
tp@0 7 % The Edge Diffraction Toolbox is free software: you can redistribute it and/or modify
tp@0 8 % it under the terms of the GNU General Public License as published by the Free Software
tp@0 9 % Foundation, either version 3 of the License, or (at your option) any later version.
tp@0 10 %
tp@0 11 % The Edge Diffraction Toolbox is distributed in the hope that it will be useful,
tp@0 12 % but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
tp@0 13 % FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
tp@0 14 %
tp@0 15 % You should have received a copy of the GNU General Public License along with the
tp@0 16 % Edge Diffraction Toolbox. If not, see <http://www.gnu.org/licenses/>.
tp@0 17 % ----------------------------------------------------------------------------------------------
tp@0 18 % c = EDB1cross(a,b)
tp@0 19
tp@0 20 %CROSS Vector cross product.
tp@0 21 % C = CROSS(A,B) returns the cross product of the vectors
tp@0 22 % A and B. That is, C = A x B. A and B must be 3 element
tp@0 23 % vectors.
tp@0 24 %
tp@0 25 % C = CROSS(A,B) returns the cross product of A and B along the
tp@0 26 % first dimension of length 3.
tp@0 27 %
tp@0 28
tp@0 29 % Clay M. Thompson
tp@0 30 % updated 12-21-94, Denise Chen
tp@0 31 % Copyright 1984-2002 The MathWorks, Inc.
tp@0 32 % $Revision: 5.18 $ $Date: 2002/04/09 00:29:46 $
tp@0 33
tp@0 34 % Special case: A and B are vectors
tp@0 35 %rowvec = 0;
tp@0 36 %if ndims(a)==2 & ndims(b)==2
tp@0 37 % if size(a,1)==1, a = a(:); rowvec = 1; end
tp@0 38 % if size(b,1)==1, b = b(:); rowvec = 1; end
tp@0 39 %end;
tp@0 40
tp@0 41 % Calculate cross product
tp@0 42 c = [a(2,:).*b(3,:)-a(3,:).*b(2,:)
tp@0 43 a(3,:).*b(1,:)-a(1,:).*b(3,:)
tp@0 44 a(1,:).*b(2,:)-a(2,:).*b(1,:)];
tp@0 45 c = reshape(c,size(a));