有没有函数可以获取插值后数据集的标准差?

问题描述 投票:0回答:1

我插值数据集如下:

y = [-2.35771490e-04, -2.04672372e-04,  5.40550849e-06, -3.26933980e-04,
       -4.31306957e-04, -4.06928662e-04, -7.50889655e-04, -1.03669983e-03,
       -5.28464040e-04, -5.01935670e-04, -8.09657243e-04, -4.21891416e-04,
       -1.35441615e-04, -3.46855608e-04, -2.90791620e-04, -8.19357356e-05,
       -2.58070932e-04, -1.58262175e-04,  1.32105126e-04,  2.42572582e-05,
        9.88706879e-05]

x = [175., 165., 155., 145., 135., 125., 115., 105.,  95.,  85.,  75.,
    65.,  55.,  45.,  35.,  25.,  15.,   5.,  -5., -15., -25.]

f = interpolate.interp1d(x, y, kind='cubic')
x_new = np.arange(-25,175, 5)
y_interp = f(x_new))

但是,我想知道是否可以计算 y_interp 中每个新元素的标准差。 y 中元素的错误是:

err = [0.00012969551729667857, 0.00014864077922340332, 0.00010732361332456688, 8.95365810198269e-05, 8.559972679579093e-05, 0.00010669277818690999, 6.880710200343582e-05, 9.249378243164652e-05, 9.885179214527947e-05, 8.352246348207366e-05, 6.586538652949116e-05, 7.428127049298688e-05, 6.506191339534108e-05, 7.166116284348538e-05, 6.379032268503384e-05, 7.101008284147194e-05, 6.0593495968463165e-05, 4.699920194672463e-05, 5.854938570487613e-05, 7.140629409894438e-05, 9.66241238445066e-05]

提前谢谢您。

python interpolation data-analysis standard-deviation
1个回答
0
投票

是的,Python中有很多计算标准差的方法!例如,您可以使用 numpy.std() 函数:

std_of_y_interp = np.std(y_interp)

如果您想知道 y_interp 中每个新元素的标准差,则每次向 y_interp 添加新元素时都必须调用此函数

© www.soinside.com 2019 - 2024. All rights reserved.