You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
data=processData()
fromscipy.integrateimportsimps, trapzgraph=data['x'][2:n/2-1]
# Compute the area using the composite trapezoidal rule.area=trapz(graph, dx=5)
print("trapezoidal area x=", area)
# Compute the area using the composite Simpson's rule.area=simps(graph, dx=5)
print("Simpson x =", area)
graph=data['y'][2:n/2-1]
# Compute the area using the composite trapezoidal rule.area=trapz(graph, dx=5)
print("trapezoidal area y=", area)
# Compute the area using the composite Simpson's rule.area=simps(graph, dx=5)
print("Simpson y =", area)
graph=data['z'][2:n/2-1]
# Compute the area using the composite trapezoidal rule.area=trapz(graph, dx=5)
print("trapezoidal area z=", area)
# Compute the area using the composite Simpson's rule.area=simps(graph, dx=5)
print("Simpson z =", area)
graph=data['rms'][2:n/2-1]
# Compute the area using the composite trapezoidal rule.area=trapz(graph, dx=5)
print("trapezoidal area rms=", area)
# Compute the area using the composite Simpson's rule.area=simps(graph, dx=5)
print("Simpson rms =", area)
n=signal.size-3timestep=0.000625freq=np.fft.fftfreq(n, d=timestep)
plt.figure(figsize=(20, 6))
plt.subplot(1,2,1)
plt.plot(freq[2:n/2-1], data['x'][2:n/2-1],label='x axis' )
plt.legend(loc='upper right')
plt.subplot(1,2,2)
plt.plot(freq[2:120], data['x'][2:120],label='x axis' )
plt.legend(loc='upper right')
plt.show()
plt.figure(figsize=(20, 6))
plt.subplot(1,2,1)
plt.plot(freq[2:n/2-1], data['y'][2:n/2-1],label='y axis' )
plt.legend(loc='upper right')
plt.subplot(1,2,2)
plt.plot(freq[2:120], data['y'][2:120],label='y axis' )
plt.legend(loc='upper right')
plt.show()
plt.figure(figsize=(20, 6))
plt.subplot(1,2,1)
plt.plot(freq[2:n/2-1], data['z'][2:n/2-1],label='z axis' )
plt.legend(loc='upper right')
plt.subplot(1,2,2)
plt.plot(freq[2:120], data['z'][2:120],label='z axis' )
plt.legend(loc='upper right')
plt.show()
plt.figure(figsize=(20, 6))
plt.subplot(1,2,1)
plt.plot(freq[2:n/2-1], data['rms'][2:n/2-1],label='rms axis' )
plt.legend(loc='upper right')
plt.subplot(1,2,2)
plt.plot(freq[2:120], data['rms'][2:120],label='rms axis' )
plt.legend(loc='upper right')
plt.show()
('trapezoidal area x=', 0.12360196506596299)
('Simpson x =', 0.12375189082977331)
('trapezoidal area y=', 0.1416781518529569)
('Simpson y =', 0.1417611851789779)
('trapezoidal area z=', 0.32075644988274854)
('Simpson z =', 0.32102093319348385)
('trapezoidal area rms=', 0.29523818043622763)
('Simpson rms =', 0.29480228984341683)