简体   繁体   English

高斯白噪声的RMS幅度

[英]RMS amplitude of gaussian white noise

I would like to compute the RMS Amplitude, of a gaussian white noise signal. 我想计算一个高斯白噪声信号的RMS幅度。

import matplotlib.pyplot as plt
import numpy as np

mean = 0
std = 1.0

t = 100

def zv(t):
    return np.random.normal(mean, std, size = t)

def rms(x):
    return np.sqrt(np.mean(zv(x)**2))

plt.plot(zv(t))

plt.plot(rms(t))

The plot of zv(t) works - but I don't know why the plot of rms(t) is just empty. zv(t)有效-但我不知道为什么rms(t)的图只是空的。

Do you have some comments? 你有什么意见吗?

Best Regards 最好的祝福

zv(t) returns a one dimensional array of size t . zv(t)返回大小为t的一维数组。 As a result, when you take the mean, it is a single value. 结果,当您取平均值时,它是一个单一值。 You can verify this by printing out the value of rms(t) . 您可以通过打印rms(t)的值来验证这一点。 If you want to create a plot along t for rms , you will need to generate multiple monte carlo samples. 如果要沿着t绘制rms ,则需要生成多个蒙特卡洛样本。 For example, 例如,

def zv(t):
    n = 1000
    return np.random.normal(mean, std, size = (n, t))

def rms(x):
    return np.sqrt(np.mean(zv(x)**2, axis = 0))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM