To simulate forward kinematics of 2R robotic arm


  Forward kinematics refers to the use of the kinematic equations of a robot to compute the position of the end-effector from specified values for the joint parameters.



Programe to simulate forward kinematics of 2R robotic arm.

%forward kinematics of 2R robotic arm

clear all
close all

% Input

for i=1:length(theta1)
for j=1:length(theta2)



% Plot
plot([x0 x1],[y0 y1],[x1 x2],[y1 y2],'linewidth',3);
axis([-0.1 1 0 1.5])




Explanation of code:

1. In our programe we have considered two links in robotic arm for simulation (x0,y0)&(x1,y1) are start and end possition of link 1 and (x1,y1) & (x2,y2) are start and end possition of link2.

2. THETA1 is angle made by link 1 with x axis and THETA2 is angle made by link 2 with x axis

theta is an array of angle whereas THETA is instantaneous value of angle.

3.Plot the possition of link 1 and link 2 by stating respective co-ordinates.

4.Here in this case  we are using octave hence used command sprintf to save file name.

5.To make gif file in octave download and instal image magick and open command prompt window type cd to change directory then type dir to check directory.

6.Now type magick *.png output.gif  

means all the files with .png extension will convert to .gif file with file name 'output'.



1.Image obtained as output are ovelaping.


2.All the images of link 1 and link 2 are obtained in single images.

error 2


Steps taken to overcome error:

1.use hold on to get separate images.

2.use pause to pause the code for some interval and will get separate images after specific interval of time.


Link for Youtube :


Projects by Piyush Misar

Objective: Write a program in Matlab that can generate the computational mesh automatically for any wedge angle and grading schemes. Simulate the velocity profile of fully developed flow at different positions along the length of the pipe.   Theory: Hydrod Read more

FVM Literature Review
Piyush Misar · 2020-02-13 09:29:38

Aim: Describe the need for interpolation schemes and flux limiters in FVM.    Theory: Finite volume method (FVM):   The Finite volume method (FVM) is a method for representing and evaluating partial differential equation. In the form of algebraic equa Read more

Aim:     To simulate the flow through a backward facing step using the icoFOAM solver.Create multiple meshes and compare the results obtained from each mesh. Objective: How does the velocity magnitude profile change as a function of mesh grading fact Read more

Objective:  Write a programe to Solve the 2D heat conduction equation by using Transient solver and a Steady state solver using Iterative technique. Theory: 2 D Temperature Heat Conduction Equation: Transient form,        &nb Read more

1 D linear convection
Piyush Misar · 2019-12-04 08:35:33

Objective:    Write the program to solve 1 D linear convection problem. Given: Assume that the domain length is L = 1m. The initial velocity profile is a step function. It is equal to 2m/s between x= 0.1 and 0.3 and 1m/s everywhere else. Constant Veloci Read more

Data analysis in python
Piyush Misar · 2019-11-01 08:50:24

Objective: Data visualizer Your script should take column numbers as the input and plot the respective columns as separate images Each file should be saved by the name of the column The plot labels should be extracted from the file. If, I request for a plot betwee Read more

Objective:  Write a code to solve given equation by using Newton Raphson method. 1.Use relaxation factor of 1 and explain your results. 2.How will you choose the optimum relaxation factor for this case? and what is the optimum relaxation factor for thi Read more

Objective:   Write a program to simulate the transient behaviour of a simple pendulum and to create an animation of it\'s motion. Introduction:      A simple pendulum is defined to have an object that has a small mass, also known as the pendu Read more

Objective: 1.Write a programe to plot P-V diagram for Otto cycle. 2.Calculate Thermal efficiency for otto cycle.   Introduction:     Otto cycle is gas power cycle on which Spark ignition engine works.It consist of four processes Process 1-2: Is Read more

2R Robotic Arm Simulator
Piyush Misar · 2019-10-10 07:35:59

Objective:   Write a Program to simulate forward kinematics of a 2R Robotic Arm. Introduction:                       A robotic arm  is a type of mec Read more


The End