Week 2- 2R Robotic Arm Challenge
https://drive.google.com/drive/folders/16ERKcFqdGH9AuUsWjOaaaLZK8cVCykOi?usp=sharing
%inputs%
l1 = 2;
l2 = 1;
t1 = linspace(0,90,5);
t2 = linspace(0,120,5);
ct = 1;
for i = 1:length(t1)
theta1 = t1(i);
for j = 1:length(t2)
theta2 = t2(j);
%coordinates%
x0 = 0;
y0 = 0;
x1 = l1*cosd(theta1);
y1 = l1*sind(theta1);
x2 = x1 + l2*cosd(theta2);
y2 = y1 + l2*sind(theta2);
%plotting%
plot([x0 x1],[y0 y1],[x1 x2],[y1 y2],'linewidth',3)
pause(0.1)
axis([-0.3 3 0.3 3]);
M(ct) = getframe(gcf);
ct = ct+1;%to increment to nextvalue of theta%
end
end
movie(M)
videofile = VideoWriter('roboarm.avi','Uncompressed AVI');
open(videofile)
writeVideo(videofile,M)
close(videofile)