Advertisement
Guest User

matlab

a guest
Apr 29th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1.  
  2. close, clear, clc
  3.  
  4. figure, hold on, axis square off
  5. vertices = 8.*rand(7,2);
  6. vertices(1,:) = [0 0];
  7. verticies(2,1)=0;
  8. verticies(end, 2) = 0;
  9. drawButton = uicontrol;
  10. set(drawButton, 'String', 'New shape', 'Position', [400, 350, 100, 40], 'FontName', 'Ariel', 'fontsize', 10)
  11. redMinus = uicontrol;
  12. set(redMinus, 'String', 'Red -', 'Position', [50, 40, 50, 40])
  13. redPlus = uicontrol;
  14. set(redPlus, 'String', 'Red +', 'Position', [100, 40, 50, 40])
  15. greenMinus = uicontrol;
  16. set(greenMinus, 'String', 'Green -', 'Position', [225, 40, 50, 40])
  17. greenPlus = uicontrol;
  18. set(greenPlus, 'String', 'Green +', 'Position', [275, 40, 50, 40])
  19. blueMinus = uicontrol;
  20. set(blueMinus, 'String', 'Blue -', 'Position', [400, 40, 50, 40])
  21. bluePlus = uicontrol;
  22. set(bluePlus, 'String', 'Blue +', 'Position', [450, 40, 50, 40])
  23.  
  24. colour = rand(3);
  25.  
  26. fill(vertices(:,1), vertices(:,2), colour);
  27. fill(-vertices(:,1), vertices(:,2), [1 1 1]);
  28. fill(vertices(:,1), -vertices(:,2), -colour);
  29. fill(-vertices(:,1), -vertices(:,2), [0 0 0]);
  30.  
  31. xlim([-10 10])
  32. ylim([-10 10])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement