Robotic arm
MATLAB SCRIPT:
close all
clear all
clc
l1=1;
l2=0.5;
x0=0;
y0=0;
theta_1=linspace(0,90,10);
theta_2=linspace(0,90,10);
frame=1
for i=1:length(theta_1)
Theta_1=theta_1(i);
x1=l1*cosd(Theta_1);
y1=l2*sind(Theta_1);
for j=1:length(theta_2)
Theta_2=theta_2(j);
x2=x1+l2*cosd(Theta_2)
y2=x2+l2*sind(Theta_2)
plot([x1 x2],[y1 y2])
axis([-0.1 2 0 2])
pause(0.03)
M(frame)=getframe(gcf)
frame=frame+1
end
end
movie(M)
videofile=VideoWriter('forward-kinematics.avi','Uncompressed AVI')
open(videofile)
writeVideo(videofile,M)
close(videofile)