File:Inverted pendulum oscillatory base.svg
Summary
Description |
English: Plots illustrating the behaviour of an inverted pendulum mounted on an oscillatory base. The first plot shows the response of the pendulum on a slow oscillation (), the second the response on a fast oscillation ().
The motion of the pendulum is given by the the following differential equation |
Date | |
Source | Own work |
Author | Nicoguaro |
SVG development | |
Source code | Python codefrom __future__ import division
import numpy as np
from numpy import sin, cos, pi
from scipy.integrate import odeint
import matplotlib.pyplot as plt
from matplotlib import rcParams
rcParams['font.size'] = 14
rcParams['legend.handlelength'] = 0
def pend(x, t, grav=9.81, length=1, amplitude=0.05, omega=10):
theta, dtheta = x
dxdt = [dtheta,
sin(theta)/length*(grav - amplitude*omega**2 * sin(omega*t))]
return dxdt
plt.figure(figsize=(14, 5))
plt.subplot(121)
time = np.linspace(0, 1.5, 101)
sol = odeint(pend, [0.1, 0], time, args=(9.81, 1, 0.05, 10))
theta, _ = sol.T
plt.plot(time, theta*180/pi, color="#e41a1c", lw=2)
plt.xlim(0, 1.5)
plt.ylim(0, 100)
plt.xlabel(r"$t$ (s)")
plt.ylabel(r"$\theta$ (deg)")
plt.legend([r"$\omega=10$"], numpoints=1, framealpha=0)
plt.subplot(122)
time = np.linspace(0, 3, 1001)
sol = odeint(pend, [0.05, 0], time, args=(9.81, 1, 0.05, 200))
theta, omega = sol.T
plt.plot(time, theta*180/pi, color="#e41a1c", lw=2)
plt.xlim(0, 2.5)
plt.xlabel(r"$t$ (s)")
plt.ylabel(r"$\theta$ (deg)")
plt.legend([r"$\omega=200$"], numpoints=1, framealpha=0)
plt.savefig("inverted_pendulum_oscillatory_base.svg", bbox_inches="tight")
plt.show()
|
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
This file is licensed under the Creative Commons Attribution 4.0 International license.
- You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
- Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.