Week 2- 2R Robotic Arm Challenge
%Diego Alejandro Cepeda Cuartas
%2D robotic arm kinematic animation
%Links angles
theta1=linspace(0,90,15)
theta2=linspace(0,90,15)
ct=1
for i=1:length(theta1)
for j=1:length(theta2)
% Angle iteration
THETA1=theta1(i)
THETA2=theta2(j)
%Parameters
xo=0
yo=0
l1=1
l2=0.5
%Position Equations
x1=l1*cosd(THETA1)
y1=l1*sind(THETA1)
x2=x1+l2*cosd(THETA2)
y2=y1+l2*sind(THETA2)
%Dynamic plot
plot([xo x1],[yo y1],[x1 x2],[y1 y2],'linewidth',3)
axis([-0.1 1.5 0 1.5])
pause(0.2)
%Video code
M(ct)=getframe(gcf)
ct=ct+1
end
end
% Video creation
movie(M)
videofile=VideoWriter('kinematic_animation.avi','Uncompressed AVI')
open(videofile)
writeVideo(videofile,M)
close(videofile)
Some screenshots of the output:


Simulation Report- Google Drive link:
https://docs.google.com/document/d/1JVs9RKyE1TyKHMi-g3CRkd-_Vl-lYeWJlUkfM5KC2LA/edit?usp=sharing