View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Inverted Pendulum

4.3 | 38 ratings Rate this file 65 Downloads (last 30 days) File Size: 690 KB File ID: #3790 Version: 1.0

Inverted Pendulum


Khalil Sultan (view profile)


29 Jul 2003 (Updated )

A collection of MATLAB files, useful for analyzing inverted pendulum & designing controller for it.

| Watch this File

File Information

The Inverted Pendulum; Analysis, Design & Implementation is a collection of MATLAB functions & scripts, and SIMULINK models, useful for analyzing Inverted Pendulum System and designing Control System for it.

The Inverted Pendulum is one of the most important classical problems of Control Engineering. Broom Balancing (Inverted Pendulum on a cart) is a well known example of nonlinear, unstable control problem. This problem becomes further complicated when a flexible broom, in place of a rigid broom, is employed. Degree of complexity and difficulty in its control increases with its flexibility. This problem has been a research interest of control engineers. In this submission, however, we have analyzed Inverted Pendulum only with rigid broom.

The aim of this study is to stabilize the Inverted Pendulum such that the position of the carriage on the track is controlled quickly and accurately so that the pendulum is always erected in its inverted position during such movements.

The inverted pendulum (IP) is among the most difficult systems to control in the field of control engineering. Due to its importance in the field of control engineering, it has been a task of choice to be assigned to Control Engineering students to analyze its model and propose a linear compensator according to the PID control law.

The work included in this submission has been carried out in the
Instrumentation and Control Lab at the Institute of Industrial Electronics Engineering, Karachi, Pakistan.

The author would like to thank Dr. Ken Dutton [School of Engineering, Sheffield Hallam University, UK; Author: "Art of Control Engineering"] for his review of this submission.

Required Products Simulink
MATLAB release MATLAB 6.5 (R13)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (51)
27 Dec 2016 bob xia

good job!

14 Jun 2015 IME Mecha engg

good work...

Comment only
27 Apr 2015 JITHIN

JITHIN (view profile)

i tried to design a swing up controller based on energy control.I just calculated the energy of pendulum and find maximum acceleration about the pivot and calculated the corresponding voltage signal and then feedback it to the system. But it won't produce correct results . I obtained graphs which is correct up to 0.325seconds after that the controlling is lost. Can you pls guide me?

Comment only
28 Dec 2013 Dail

Dail (view profile)

12 Jun 2012 Atif Anwer

05 Dec 2010 engesin Esin

19 Sep 2010 Dr Raveendranathan K C

Good work.

04 Jun 2010 Anamaria Lupu

Hi! I took a look on your paper work and I find it very interesting and complete. I had to develop a project about an Inverted Pendulum and this was very helpful.
However, when I put a scope on the PID law (ipcstep.mdl), I saw an infinite command (~2.2*exp15). I think this is the result of simplifying an unstable zero by introducing an integrator.
I would like to know your response; maybe I’m wrong, but I need your help for my project.
A million thanks,

Comment only
21 Mar 2010 timm maths

Excellent Work.

18 Mar 2010 Mechatronic Kumar

Hi, may I know if it is possible to keep the pendulum balanced at a desire angle from the vertical without the cart below going to infinity? Thank you.

Comment only
28 Aug 2009 Leonardo Araujo

Leonardo Araujo (view profile)

Very Nice I've also used here
It's the Inverted Pendulum control simulation with SimMechanics in Simulink

03 Jan 2009 Daniel Baker

Great Job - very detailed! I just want to mention something that seems a bit confusing. You state that the steady state error is zero in response to a unit step input, but the output is 0.35 rather than 1. The open loop transfer function is a type zero, which would not be able to render a zero steady state error in response to a step input. I was able to calculate a steady state error of 0.65, which leads to the output of 0.35. I'm certainly not an expert, and might be analyzing this incorrectly, but wanted to make note of it since the paper seems so complete otherwise.

16 Apr 2008 Not Fake

Comprehensive, helpful, thorough. Excellent example.

17 Feb 2008 Zaheer Mohammed

28 Jan 2008 Muhammad Faisal

Very good work.Keep it up

17 Jan 2008 Zaheer Ahmed

17 Jan 2008 saad mubeen

04 Dec 2007 salim awde

very important work

22 Nov 2007 Ravi varma bhpathiraju

29 Oct 2007 Nguyen Thanh Phuc

07 Oct 2007 UDAY KUMAR

The over all assessment of the problem is good. The control of inverted pendulum using fuzzy systems is needed

27 Sep 2007 anh duy

01 Jun 2007 Sadid S.

I am a student in electronic
It was very useful for me as a good tutorial for Matlab Control and also my very elementary control learning course(Linear Control)
Thank you!

16 May 2007 Thirunavukkarasu Indiran

It will be very usefull for the research peoples who want to validate their results in real time systems.

13 May 2007 Ichiro Inui

I have some delusions and dissociations about Inverted Pendulum.
I developed new type Inverted Pendulum for gain-scheduling control theory in Japan.
If you have any intersts for this message please contuct me.

Comment only
26 Apr 2007 fatemeh darakeh

i want some file

Comment only
25 Mar 2007 srisuneel bhaskar

its very help full for beginners now i am doing the same by using model predictive control technique.if any body have suggestions please give me at

26 Feb 2007 Sasa Milovanovic

Most complete paper on this subject!
Very good work!

03 Jan 2007 Vishnuvenkatesh Dhage

09 Dec 2006 phuc nguyen

19 Sep 2006 Fabiano Souza

I can't open...error in acrobat.

Comment only
28 Jul 2006 Gledson Melotti

Hi Khalil Sultan, all good one. I found its site in the Internet and I liked it very content about controlling using matlab. By chance you have some you would materia on the controlled inverted pendulum for logic fuzzy.

I am thankful since already for the attention, Gledson Melotti.

Comment only
19 Jul 2006 Markos X

I want to ask u something. Supposing we have the pendulum at 0 degrees angle and we want to force it to go to 180 degrees angle. Can u help me write this code?

Comment only
12 Jul 2006 nil nil

i think u are not concidering the moment of inertia of the connector. it may be a significant factor if we are using a solid connector

06 Mar 2006 MHB murshid

am doing a project in inverted pendulum so hope this might help me in anyways

Comment only


18 Nov 2005 Minh Thanh Phan

Dung cai toi dang tim

03 Nov 2005 Florin Blaga

18 Oct 2005 Ricardo Vecchio

01 Oct 2005 davide rapicavoli

14 Aug 2005 vikrant kumar


Comment only
08 Jun 2005 well wisher


20 May 2005 ida saya

thank you.your paper have help me a lot.thank you very much.

Comment only
03 May 2005 Gary Rosende

Your paper is very good.

Comment only
13 Dec 2004 Chris Perkins

Good god that is fantastic!

02 Dec 2004 Jeff G

As a Master's student in the US, hats off to the author! This is truly an excellent presentation.

I'd love to see it redone, though, using State-Space, and LQR techniques rather than Classical Design Theory!

Great write-up!

21 Sep 2004 srikanth chinta

great help

25 Jul 2004 Shanbin Li

A wonderful work! Thank you!

21 Jul 2004 nima moshtagh

10 Apr 2004 hosein sadeghi

19 Feb 2004 Justin Alcorn

thank you, I'm started studying controls recently and that was very helpful on my education.

07 Aug 2003

Change of category in MATLAB File Exchange, change in keywords, summary and description.

Contact us