Here is an example for reading and playing a wav file and for displaying its FFT magnitude: wav_player.py. This script also has an option to convert the wav file to a time history in ASCII text format.

The audio scripts determine whether the operating system is Windows or Linux.

The odeint function in the scipy.integrate package is a wrapper around lsoda, an ODE integrator developed at Lawrence Livermore National Lab, as part of the odepack package. lsoda/odeint automatically switches between stiff and non-stiff integration routines, depending on the characteristics of the solution, and does adaptive time-stepping to achieve a desired level of solution accuracy.
The function may be accessed via

from scipy.integrate import odeint

* * *

Free Vibration Example

A script for the response of a single-degree-of-freedom (SDOF) system subjected to initial condition excitation is given at: sdof_initial.py. An example is given in: sdof_initial_py.pdf.

A similar multi-degree-of-freedom (MDOF) system script is given at: mdof_initial.py

The MDOF script shows how odeint can be applied to simultaneous second-order ODEs.

* * *

Response to Sinusoidal Base Excitation

A script for the response of an SDOF system subjected to sinusoidal base excitation is given at: sdof_base_sine.py

The odeint solver is intended for initial condition excitation and for external excitation where the forcing function is a continuous analytical function.

The odeint function can be used for a random or arbitrary excitation as follows. First, take a Fourier transform of the forcing function. Second, pass the Fourier coefficients and frequencies to the ode function. Third, represent the excitation time history via a series of analytical sine and cosine terms inside the ode function. This method requires careful bookkeeping. It is also numerically inefficient. Thus, it is only recommended in academic settings.

A faster approach is to simply use the Runge-Kutta Fourth-order method, as shown in the following script.

A script for the response of an SDOF system subjected to arbitrary base excitation is given at: arbit_rk4.py

The response to base acceleration or enforced acceleration is given at: mdof_modal_enforced_acceleration_rk4.py. It is intended for the case where damping is applied via a modal damping ratio. The system is first partitioned via a transformation matrix. Next it is decoupled using normal modes. Then the response is calculated using the RK4 method as a modal transient solution. A partition tutorial is given at: modal_enforced_motion.pdf

Some of the scripts use the generalized eigenvalue function to calculate the natural frequencies. This step is not part of the Newmark calculation except for the modal transient implementations. Rather the natural frequencies are given for reference only for the direct implementation.

* * *

Newmark-beta Function

The Newmark-beta method is used for direct integration of a system of structural dynamics equations.

The system equations are second-order ordinary differential equations. The system may be excited by initial conditions or an external forcing function.

* * *

Free Vibration

The following examples use the Newmark function.

The response of a single-degree-of-freedom system to initial excitation is given at: sdof_initial_nm.py

The response of a multi-degree-of-freedom system to initial excitation is given at: mdof_initial_nm.py

* * *

Response to Applied Force, Direct Integration

The response of a multi-degree-of-freedom system to an applied force or forces is given at: mdof_arbit_force_nm.py. It is intended for the case where damping is applied via a damping coefficient matrix.

* * *

Response to Applied Force, Modal Transient

The response of a multi-degree-of-freedom system to an applied force or forces is given at: mdof_modal_arbit_force_nm.py. It is intended for the case where damping is applied via a modal damping ratio. The system is decoupled via the normal modes as an intermediate step.

* * *

Response to Base Excitation, Modal Transient

The response of a multi-degree-of-freedom system to base acceleration or enforced acceleration is given at: mdof_modal_enforced_acceleration_nm.py. It is intended for the case where damping is applied via a modal damping ratio. The system is first partitioned via a transformation matrix. Next it is decoupled using normal modes. Then the response is calculated using the Newmark method as a modal transient solution. A partition tutorial is given at: modal_enforced_motion.pdf

A script for calculating the natural frequency of a rectangular plate supported at each corner is given at plate_corners.py

The natural frequency is calculated via the Rayleigh method. The resulting fundamental mode shape is displayed using a Matplotlib surface plot.

* * *

Circular Plates

A script for calculating the natural frequencies of the bending modes of a circular plate, with options for both homogenous and honeycomb-sandwich designs is given at circular_plate.py. This script demonstrates a 3D surface plot for a polar base.