模拟广义衰落信道
maoud的Python项目详细描述
python中广义衰落信道的仿真
假设有一个复杂的密度函数,在Scipy中没有实现,例如yacoub的kappa mu。 别担心,maoud帮你搞定了:
import numpy as np import scipy.special as sps def kappa_mu_pdf(x, kappa, mu): return (2.0 * mu * np.power(1.0 + kappa, (mu + 1.0) / 2.0) * np.power(x, mu) * np.exp(-mu * (1.0 + kappa) * x * x - mu * kappa + 2 * x * mu * np.sqrt(kappa * (1.0 + kappa))) * sps.ive(mu - 1, 2 * mu * x * np.sqrt(kappa * (1.0 + kappa))) / (np.power(kappa, (mu - 1.0) / 2.0)))
然后您要执行以下操作以绘制样本:
from maoud.sampling import rejection_sampling n_samples = int(1e6) kappa = 0.75 mu = 0.87 low = 1e-6 high = 3 kappa_mu_samples, af = rejection_sampling(kappa_mu_pdf, low, high, n_samples, kappa, mu)
为了验证样本是否符合yacoub的kappa mu密度,我们绘制样本的直方图:
import matplotlib.pyplot as plt x = np.linspace(1e-6, 3, 1000) y = kappa_mu_pdf(x, kappa, mu) plt.plot(x, y) plt.hist(kappa_mu_samples, bins=50, normed=True)
沙扎姆!!
引文
如果您使用了此存储库中可用的代码,请考虑 引用以下工作:
@ARTICLE{7986939, author={J. V. M. Cardoso and W. J. L. Queiroz and H. Liu and M. S. Alencar}, journal={Tsinghua Science and Technology}, title={On the performance of the energy detector subject to impulsive noise in κ—μ, α—μ, and η—μ fading channels}, year={2017}, volume={22}, number={4}, pages={360-367}, doi={10.23919/TST.2017.7986939}, month={Aug},}