Python生成高斯白噪声white noise

Python生成高斯白噪声white noise

  • 原理

原理

r a n d o m ( N ) ⋅ ∑ x i 2 N ⋅ 1 0 − s n r / 10 random(N) \cdot \sqrt{\frac{\sum{x_{i}^{2}}}{N} \cdot 10^{-snr/10}} random(N)Nxi210snr/10

假设序列X长度为N。

import numy as np

def generate_white_noise(X, N, snr)
	noise = np.random.randn(N)
	snr = 10 ** (snr/10)
	power = np.mean(np.square(X))
	npower = power / snr
	noise = noise * np.sqrt(npower)

你可能感兴趣的:(Machine,Learning,机器学习)