Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % Brian Slaboch
- % Program Description:
- % INPUTS:
- % OUTPUTS:
- % DATE:
- % VERSION:
- clc
- clear
- % semicolon suppress output
- a = 6;
- c = [ 1 4 6];
- d = [3,4,7]';
- transpose(c);
- % linspace command
- x = linspace(4,10,5);
- % colon operator
- y = 6:2:20;
- y(3);
- y(end);
- sum(y);
- min(y);
- a = [3 4 5] ;
- b = [2 3 1];
- c = a+b;
- c = a-b;
- r = a.*c;
- r = a./c;
- r = a.^c;
- %% for loops
- z = 4;
- %format long
- for i = 1:.5:4
- z = z+2;
- end
- x = 6;
- while x >7
- x = x -1;
- end
- %% Robot Simulation
- l1 = 5
- l2 = 2
- deg2rad = pi/180;
- theta1 = linspace(0,360,100)*deg2rad;
- theta2 = linspace(0,360,100)*deg2rad;
- for i = 1:length(theta1)
- x0 = 0;
- y0 = 0;
- x1 = x0+l1*cos(theta1(i));
- y1 = y0+l1*sin(theta1(i));
- x2 = x1+l2*cos(theta1(i)+theta2(i));
- y2 = y1 + l2*sin(theta1(i) + theta2(i));
- plot([x0 x1 x2],[y0 y1 y2],'ro-')
- xlabel('x axis')
- axis equal
- axis([-7 7 -7 7])
- getframe
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement