Advertisement
urbmal

l2

Feb 26th, 2020
492
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.61 KB | None | 0 0
  1. %[region]=define_regions([0, 10,0,10], 4);
  2.  
  3. %% citire
  4. N=input('How many regions would you like to draw?\n');
  5.  
  6.  
  7. figure()
  8. axis([0 20 0 20]),hold on;
  9. %% desenare a)
  10. for i=1:N
  11. [x,y] = ginput(6);
  12.  plot(x,y, '.');
  13.        k = convhull(x,y);
  14.        hold on, plot(x(k), y(k), '-r'), hold off
  15.        axis([0 9 0 9]),hold on;
  16.        fill(x(k),y(k),'o')
  17.        Region{i}.x=x(k); Region{i}.y=y(k);
  18.        centre{i}.x=mean(Region{i}.x);
  19.        centre{i}.y=mean(Region{i}.y);
  20. end
  21.  
  22.  
  23. %% little robot b)
  24. hold on;
  25. [rx,ry]= ginput(1);
  26. plot(rx,ry,'*k');
  27. speed=input('Do you like speed? Enter the speed please\n');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement