Project

Simulation of forward kinematics of a 2R Robotic Arm in MATLAB

MATLAB CODE

clear all
close all

%initial points
x_0 = 0
y_0 = 0

%length of the arm
l_1 = 5
l_2 = 2

%range o f the  angle of both arm
theta1 = linspace(0,60,10)
theta2 = linspace(0,30,10)


for i = 1:length(theta1)
x_1 = x_0 + l_1*cosd(theta1(i))
y_1 = y_0 + l_1*sind(theta1(i))
    for j = 1:length(theta2)
    x_2 = x_1 + l_2*cosd(theta2(j))
    y_2 = y_1 + l_2*sind(theta2(j))
   
    plot([x_0 x_1],[y_0 y_1],'linewidth',3,'color','r')
    hold on
    plot([x_1 x_2],[y_1 y_2],'linewidth',3)
    axis([0 10 0 10])
    pause(.01)
    hold off
    end

end


OUTPUT

final image of the output:

To see all the screen shots of the outputs please click the link below:

https://drive.google.com/open?id=1u03iYJzR1wZkgDxDkcI0gJryXjnxyfSk

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.