Advertisement
Guest User

Untitled

a guest
May 20th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.57 KB | None | 0 0
  1. X = [2,3,4 ; 3,3,4 ; 4,4,4 ; 5,4,4 ; 5,4,5 ; 4,4,5 ; 3,3,5 ; 2,3,5 ; 2,3,4];
  2. hold on
  3.  
  4. xj = [X ones(9,1)];
  5.  
  6. S = [sum(X(:,1))/9, sum(X(:,2))/9, sum(X(:,3))/9];
  7. W = [1 0 0 0; 0 1 0 0; 0 0 1 0; -S(1) -S(2) -S(3) 1];
  8. RX = [1 0 0 0; 0 0 1 0; 0 -1 0 0; 0 0 0 1];
  9. RY = [1 0 0 0; 0 1 0 0; 0 0 d 0; 0 0 0 1];
  10.  
  11. for theta = 30:30:360
  12.  rad = (pi * theta)/180;
  13.  WZ = [cos(rad) sin(rad) 0 0; -sin(rad) cos(rad) 0 0; 0 0 1 0; 0 0 0 1];
  14.  R = xj * W;
  15.  R = R * RX;
  16.  R = R * RY;
  17.  R = R * WZ;
  18.  R = R * inv(RY);
  19.  R = R * inv(RX);
  20.  R = R * inv(W);
  21.  plot3(R(:,1), R(:,2), R(:,3));
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement