Consider a spring mass system with natural period of 0.45 [s]. Calculate the new period if a spring constant is icreased by 10, 50, 100, 200, 500\%.
τ1=0.21[s]=2π√mkτ10=2π√m√1.1k=2π(0.21√k2π)√1.1k=0.21√k√1.1k=0.20022714374157435[s]
τ20=2π√m√1.5k=2π(0.21√k2π)√1.5k=0.21√k√1.5k=0.17146428199482247[s]
τ30=2π√m√2k=2π(0.21√k2π)√2k=0.21√k√2k=0.14849242404917495[s]
τ40=2π√m√3k=2π(0.21√k2π)√3k=0.21√k√3k=0.12124355652982141[s]
τ50=2π√m√5k=2π(0.21√k2π)√5k=0.21√k√5k=0.09391485505499116[s]
For this example we will also need two libraries matplotlib and numpy.
Figure 1 - The natural period versus spring constant increase.
As seen from Figure 1 as the spring constant or spring stiffness increases the natural period of the system decreases from initial 0.2002 up to 0.09 [s] when spring constant increased from 10 up to 500%.
Solution in Pyhton
For this example we will also need two libraries matplotlib and numpy.
import numpy as np import matplotlib.pyplot as pltWe have a constant value (natural period) that we will define as:
tau_0 = 0.21Then we will define the increase of the spring constant or spring stiffness as list:
Spring_Const = [1.1, 1.5, 2, 3, 5]Then we will define the empty list named tau_res.
tau_res = []Now we will create a for loop that will calculate new natural period and store its value into the taur_res list.
for i in range(len(Spring_Const)): res = tau_0/np.sqrt(Spring_Const[i]) tau_res.append(res)The np.sqrt is the square root function from the numpy library. Now we can plot results in which we will show how natural period changes versus spring constant inscrease:
plt.rcParams["font.family"] = "Times New Roman"
SMALL_SIZE = 20
MEDIUM_SIZE = 22
BIGGER_SIZE = 24
plt.rc('font', size=SMALL_SIZE) # controls default text sizes
plt.rc('axes', titlesize=SMALL_SIZE) # fontsize of the axes title
plt.rc('axes', labelsize=MEDIUM_SIZE) # fontsize of the x and y labels
plt.rc('xtick', labelsize=SMALL_SIZE) # fontsize of the tick labels
plt.rc('ytick', labelsize=SMALL_SIZE) # fontsize of the tick labels
plt.rc('legend', fontsize=SMALL_SIZE) # legend fontsize
plt.rc('figure', titlesize=BIGGER_SIZE) # fontsize of the figure title
SpringPER = [10,50,100,200,500]
plt.figure(figsize=(12,8))
plt.plot(SpringPER, tau_res)
plt.xlabel("Spring Constant Increase [%]")
plt.ylabel("Natural period [s]")
plt.grid(True)
plt.xlim(0,500)
plt.ylim(0,0.21)
plt.show()
Nema komentara:
Objavi komentar