Week 2- 2R Robotic Arm Challenge
The program is to simulate the forward kinematics of a 2R Robotic Arm

the program is to simulate how the robotic arm moves
here the i used two linkage system, with specified x and y coordinates.
%challenge 4 robo arm
clear all
close all
clc
%input
l1=2
l2=1.5
theta_1=linspace(0,45,10);
theta_2=linspace(0,80,10);
ct=1
for i=1:length(theta_1)
ANGLE1=theta_1(i);
for j=1:length(theta_2)
ANGLE2=theta_2(j);
x0=0;
y0=0;
x1=l1*cosd(ANGLE1);
y1=l1*sind(ANGLE1);
x2=x1+l2*cosd(ANGLE2);
y2=y1+l2*sind(ANGLE2);
%plotting
plot([x0 x1],[y0 y1],[x1 x2],[y1 y2],'linewidth',5)
axis([-0.5 2 -0.5 2])
pause(0.03)
M(ct)=getframe(gcf);
ct=ct+1;
end
end
movie(M)
videofile=VideoWriter('chalenge_4_mechanical.AVI'),('uncompressed AVI');
open(videofile)
writeVideo(videofile,M)
close(videofile)
ERRORS:
while working on this program i came across different sets of error and capture few to explain

in the above error i have added sin in x also and i missed the y coordinates value, and i wrongly added the colon in line width '5'
Plot:


simulation video file is created and attached in the below location