SHARE
TWEET

Untitled

a guest Sep 18th, 2019 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. % Brian Slaboch
  2. % Program Description:
  3. % INPUTS:
  4. % OUTPUTS:
  5. % DATE:
  6. % VERSION:
  7.  
  8. clc
  9. clear
  10.  
  11. % semicolon suppress output
  12. a = 6;
  13.  
  14. c = [ 1 4 6];
  15. d = [3,4,7]';
  16. transpose(c);
  17.  
  18. % linspace command
  19. x = linspace(4,10,5);
  20.  
  21. % colon operator
  22. y = 6:2:20;
  23.  
  24. y(3);
  25. y(end);
  26. sum(y);
  27. min(y);
  28.  
  29. a = [3 4 5] ;
  30. b = [2 3 1];
  31.  
  32. c = a+b;
  33. c = a-b;
  34.  
  35. r = a.*c;
  36.  
  37. r = a./c;
  38.  
  39. r = a.^c;
  40.  
  41. %% for loops
  42.  
  43. z = 4;
  44. %format long
  45. for i = 1:.5:4
  46.    
  47.     z = z+2;
  48. end
  49.  
  50.  
  51.  
  52. x = 6;
  53. while x >7
  54.     x = x -1;
  55. end
  56.  
  57. %% Robot Simulation
  58. l1 = 5
  59. l2 = 2
  60.  
  61. deg2rad = pi/180;
  62.  
  63. theta1 = linspace(0,360,100)*deg2rad;
  64. theta2 = linspace(0,360,100)*deg2rad;
  65.  
  66. for i = 1:length(theta1)
  67.  
  68.     x0 = 0;
  69.     y0 = 0;
  70.    
  71.     x1 = x0+l1*cos(theta1(i));
  72.     y1 = y0+l1*sin(theta1(i));
  73.  
  74.     x2 = x1+l2*cos(theta1(i)+theta2(i));
  75.     y2 = y1 + l2*sin(theta1(i) + theta2(i));
  76.    
  77.     plot([x0 x1 x2],[y0 y1 y2],'ro-')
  78.     xlabel('x axis')
  79.    
  80.     axis equal
  81.     axis([-7 7 -7 7])
  82.     getframe
  83.    
  84. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top