Image:Pendulum-plots.png

From Wikipedia, the free encyclopedia

[edit] Summary

Plots illustrating the behaviour of an inverted pendulum mounted on an 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

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeDimensionsUserComment
current10:01, 19 February 20071,076×420 (6 KB)Chojitsa (Talk | contribs) (Plots illustrating the behaviour of an inverted pendulum mounted on a oscillatory base. (I created this image using Matlab))

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