Advertisement
Guest User

Untitled

a guest
May 25th, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.48 KB | None | 0 0
  1. p1=[0;0];
  2. p2=[0.5;2];
  3. p3=[0;1];
  4.  
  5. plotx=[p1(1) p2(1) p3(1) p1(1)];
  6. ploty=[p1(2) p2(2) p3(2) p1(2)];
  7.  
  8. t=input('Geef een rotatiehoek in: ');
  9. t=t*(pi/180);
  10.  
  11. rotate=[cos(t) -sin(t); sin(t) cos(t)];
  12.  
  13. tp1=rotate*p1;
  14. tp2=rotate*p2;
  15. tp3=rotate*p3;
  16.  
  17. plottx=[tp1(1) tp2(1) tp3(1) tp1(1)];
  18. plotty=[tp1(2) tp2(2) tp3(2) tp1(2)];
  19.  
  20. figure(1);
  21. plot(plotx, ploty,'-');
  22. hold;
  23. plot(plottx, plotty, '-.');
  24. legend('origineel',strcat('geroteerd'));
  25. axis equal;
  26. axis([-2.5 2.5 -2.5 2.5]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement