clear all
close all
clc
%input values
%Lenghth of the link (cm)
l1=2;
l2=1;
%Angle(Degrees)
d1=linspace(0,90,20);
d2=linspace(0,90,20);
x0=0;
y0=0;
c=1;
for i=1:length(d1)
D1=d1(i);
for j=1:length(d2)
D2=d2(j);
%Co-ordinates of the arms
x1=l1.*cosd(D1);
y1=l1.*sind(D1);
x2=x1+l2.*cosd(D2);
y2=y1+l2.*sind(D2);
%plot
plot([x0 x1],[y0 y1],[x1 x2],[y1 y2],'LineWidth',3);
axis([-1 3 0 3]);
pause(0.01);
M(c)=getframe(gcf)
c=c+1;
end
end
%To create video of the plots
movie(M)
videofile=VideoWriter('robotic_arms_c.avi','Uncompressed AVI');
open(videofile)
writeVideo(videofile,M)
close(videofile)