File:Inverted pendulum oscillatory base.svg

From testwiki
Jump to navigation Jump to search
    Original file (SVG file, nominally 1,070 × 431 pixels, file size: 60 KB)

    This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.

    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 (ω=10), the second the response on a fast oscillation (ω=200).

    The motion of the pendulum is given by the the following differential equation

    θ¨−gℓsin⁡θ=−Aℓω2sin⁡ωtsin⁡θ.
    Date
    Source Own work
    Author Nicoguaro
    SVG development
    InfoField
     The SVG code is valid.
     This plot was created with Matplotlib.
    Source code
    InfoField

    Python code

    from __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:
    w:en:Creative Commons
    attribution
    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.

    Captions

    Add a one-line explanation of what this file represents

    Items portrayed in this file

    depicts

    4 July 2016

    File history

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

    Date/TimeThumbnailDimensionsUserComment
    current05:53, 5 July 2016Thumbnail for version as of 05:53, 5 July 20161,070 × 431 (60 KB)wikimediacommons>NicoguaroUser created page with UploadWizard

    There are no pages that use this file.