
% A program for forward kinematics of a robotic arm manipulator
clear all;
clc;
% inputs
l1=1;
l2=0.5;
thetha1=linspace(0,90,10);
thetha2=linspace(0,90,10);
ct=1
for i=1:length(thetha1)
THETHA1=thetha1(i);
for j=1:length(thetha2)
THETHA2=thetha2(j);
x0=0;
y0=0;
x1=l1*cosd(THETHA1);
y1=l1*sind(THETHA1);
x2=x1+l2*cosd(THETHA2);
y2=y1+l2*sind(THETHA2);
% plotting
plot([x0 x1],[y0 y1] ,[x1 x2],[y1 y2],'linewidth',3)
axis([-0.1 1.5 0 1.5]);
pause(0.3)
M(ct) = getframe(gcf);
ct=ct+1
end
end
movie(M);
Videofile = VideoWriter('forward_kinematics.avi','Uncompressed AVI');
open(Videofile)
writeVideo(Videofile,M)
close(Videofile)