Advertisement
hiddenGem

Function: CDMA

Sep 1st, 2020
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.44 KB | None | 0 0
  1. function[cr, dt, mag, thetad, thetar] = CDMA(a,b)
  2. % Gives cross product, dot product, magnitude, and angle between vectors in
  3. % degrees and radians
  4. cr = cross(a,b);
  5. % Cross product
  6. dt = dot(a,b)
  7. % Dot product
  8. mag = sqrt(sum(cr.^2));
  9. % Magnitude of vectors
  10. MagA = sqrt(sum(a.^2));
  11. MagB = sqrt(sum(b.^2));
  12. thetad = acosd(dot(a,b)/(MagA*MagB));
  13. % Angle between in degrees
  14. thetar = acos(dot(a,b)/(MagA*MagB));
  15. % Angle between in radians
  16. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement