Advertisement
Guest User

patrate

a guest
Oct 23rd, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Octave 0.60 KB | None | 0 0
  1. P = [1,0,-1,0,1;0,1,0,-1,0];
  2. plot(P(1,:),P(2,:),'b');
  3. axis([-5,5,-5,5],"square");
  4. alfa = pi/8;
  5. hold on;
  6. for i=1:3
  7.   T = [cos(alfa) -sin(alfa); sin(alfa) cos(alfa)];
  8.   P = T*P;
  9.   plot(P(1,:),P(2,:),'b');
  10. endfor
  11. figure(2)
  12. axis([-3,3,-3,3],"square");
  13. P = [1,0,-1,0,1;0,1,0,-1,0];
  14. hold on;
  15. for i=1:50
  16.   T = [cos(alfa) -sin(alfa); sin(alfa) cos(alfa)];
  17.   P = T*P;
  18.   P = P*0.9;
  19.   fill(P(1,:),P(2,:),'r');
  20. endfor
  21. figure(3);
  22. P = [1,0,-1,0,1;0,1,0,-1,0];
  23. hold on;
  24. for i=1:50
  25.   T = [cos(alfa) -sin(alfa); sin(alfa) cos(alfa)];
  26.   P = T*P;
  27.   P = P*0.9;
  28.   P = P+[1;2];
  29.   fill(P(1,:),P(2,:),'g');
  30. endfor
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement