如何将高斯函数分割成等体积的部分

How to segment a gaussian function to equal-volume parts

我正在尝试将高斯曲线分割成 K 个等体积段,Python 用于信号过滤目的。

我正在寻找伪代码、一般想法或执行它的库。 任何帮助将不胜感激。

谢谢!

例如下图中:K=6。卷 s1 = s2 = ... = s6:

您需要确定分布的百分位数。您可以使用此 scipy.stats.norm class 及其 .ppf() 方法。

import numpy as np
import scipy.stats as sps
import matplotlib.pyplot as plt

mu = 25
sigma = 4
splits = 8

# define the normal distribution and PDF
dist = sps.norm(loc=mu, scale=sigma)
x = np.linspace(dist.ppf(.001), dist.ppf(.999))
y = dist.pdf(x)

# calculate PPFs
step = 1 / splits
quantiles = np.arange(step, 1.0 - step / 2, step)
ppfs = dist.ppf(quantiles)  # boundaries

# plot results
fig, ax = plt.subplots(figsize=(10, 4))
ax.plot(x, y, color='k')
for i, ppf in enumerate(ppfs):
    ax.axvline(ppf, color=f'C{i}', label=f'{quantiles[i]:.3f}: {ppf:.1f}')
ax.legend()
plt.show()

这是基于 this answer