HEV-Example 2 - Determine the period of beating for spring-mass system

A spring-mass system is subjected to a harmonic force whose frequency is close to the natural frequency of the system. If the forcing frequency is 39.8 [Hz] and the natural frequency is 40 [Hz], determine the period of beating.
The forcing frequency is 39.8 [Hz] which will be defined as: $$\omega = 2\pi39.8$$ The natural frequency is 40 [Hz] which will be defined as: $$ \omega_n = 2\pi40$$ The period of beating will be calcualted using formula: $$\tau_d = \frac{2\pi}{(\omega_n - \omega)}$$ $$ \tau_d = \frac{2\pi}{2\pi(40 - 39.8)} = 5 [\mathrm{s}]$$

Solution in Python

To solve this example in Python first we will need to import the numpy library.
import numpy as np
This library is required for \(\pi\) number. The math library can also be used. The first step is to define the forcing frequency and the natural frequency.
omega = 39.8
omega_n = 40
The period of beating can now be easily calculated:
tau_d = (2*np.pi)/(2*np.pi*(omega_n - omega))
print("tau_d = {}".format(tau_d))
The output of the previous code is:
taud=4.9999 
If we want the result to be rounded we will use the Python built-in round function in taud formula.
tau_d = round((2*np.pi)/(2*np.pi*(omega_n - omega)),1)
print("tau_d = {}".format(tau_d))
The output is given below.
tau_d = 5

Nema komentara:

Objavi komentar