Image:Pendulum-plots.png

From Wikipedia, the free encyclopedia

[edit] Summary

Plots illustrating the behaviour of an inverted pendulum mounted on a oscillatory base. I created this image using Matlab. The following code is used in m-files to simulate the behaviour of the inverted pendulum on an oscillatory base:

The main program that creates the plot:

% initialisation
clear all % erasing all previously used variables
close all % closing open windows
clc %clear command prompt

% simulation
[T, XY] =ode45('diffxy',0,10,[0.1 0]); 
%simulate differential equation for time = 0 to 10 sec, initial disturbance angle is 0.1 radian, initial velocity is zero

% plotting commands
plot(T,XY(:,1)*180/pi)
AXIS([0 5 -90 90])
ylabel('\theta [deg]')
xlabel('t [s]')

The program that implements the differential equation:


function dxy= diffxy(t,xy)

% parameters

g=9.81;  %gravitational acceleration [m/s^2]
l=1;        %length of the pendulum [m]
A=.05;    %amplitude of the oscillation [m]
omega=1000; % frequency of the oscillation [rad/sec]

% implementation of the differential equation

theta=xy(1);
thetadot=xy(2);
thetadot=thetadot;
thetaddot=1/l*(-sin(theta)*(A*omega^2*cos(omega*t)-g));

% return result

dxy=[thetadot, thetaddot]';

[edit] Licensing

Public domain

I, the creator of this work, hereby release it into the public domain. This applies worldwide.
In case this is not legally possible,
I grant any entity the right to use this work for any purpose, without any conditions, unless such conditions are required by law.

File history

Legend: (cur) = this is the current file, (del) = delete this old version, (rev) = revert to this old version.
Click on date to download the file or see the image uploaded on that date.


The following pages on the English Wikipedia link to this file (pages on other projects are not listed):