home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l460 / 3.ddi / DEMOS.DI$ / CROSS.M < prev    next >
Encoding:
Text File  |  1993-03-07  |  405 b   |  16 lines

  1. function z = cross(x,y)
  2. %CROSS    Vector cross product.
  3. %    z = cross(x,y).  x and y are usually vectors with 3 components.
  4.  
  5. %    Copyright (c) 1984-93 by The MathWorks, Inc.
  6.  
  7. if (length(x) == 3) & (length(y) == 3)
  8.    I = eye(3,3);
  9.    z = x;
  10.    for j = 1: 3
  11.       z(j) = det([x(:) y(:) I(:,j)]);
  12.    end
  13. elseif isstr(x) & isstr(y)
  14.    z = ['norm(' x ') * norm(' y ') * sin(angle(' x ',' y '))'];
  15. end
  16.