【发布时间】:2018-11-01 09:40:33
【问题描述】:
我正在尝试使用 Simpson 方法对一组数据进行集成。我发现我可以执行以下操作,如下所示:result=simps(velocity, time, dx=(1/60))。我希望间距以秒为单位而不是分钟(因此为 1/60) - 但更改 dx 的值不会改变我的结果。如何在几秒钟内与 dx 集成?
# import the necessary modules
import numpy as np
import matplotlib.pyplot as plt
# reads the experimnetal data
a=np.loadtxt("VelvstUniform.txt")
# assigns the data columns
time=a[:,0]
velocity=a[:,1]
# graphs in the same figure Sunspots vs Year and LEO vs Year
plt.plot(time,velocity,markersize=10, color="green", marker="o",
linestyle="-")
plt.xlabel("Time (min)", fontweight="bold", fontsize="large")
plt.ylabel("velocity (miles/hour)", fontweight="bold", fontsize="large",
color="green")
from scipy.integrate import simps
result=simps(velocity, time, dx=(1/60))
print(result)
【问题讨论】:
标签: python python-3.x