2R Robotic arm
% main programme
clc
x0=0;
y0=0;
l1=1;
l2=0.5;
t1=linspace(0,90,10);
t2=linspace(0,90,10);
c=1;
for i=1:length(t1);
x1=l1*cosd(t1(i));
y1=l1*sind(t1(i));
for j=1:length(t2);
x2=x1+l2*cosd(t2(j));
y2=y1+l2*sind(t2(j));
% plotting graphs
plot([x0 x1],[y0 y1],[x1,x2],[y1,y2],\'linewidth\',3);
axis([0 1.5 0 1.5])
pause(0.05);
m(c)= getframe(gcf); %getting frames to create animation
c=c+1;
end
end
% creating animation
movie(m)
vf= VideoWriter(\'kinematics.avi\');
open(vf)
writeVideo(vf,m)
close(vf)