用Matlab产生幅度在[-1 1]之间的白噪声 [英] Generate white noise with amplitude between [-1 1] with Matlab
问题描述
我正在使用Matlab函数Y = WGN(M,N,P)
生成具有高斯分布的白噪声.此功能使用功率值(dB瓦)来计算输出信号的幅度.由于我想获得-1 V至1 V的输出幅度范围,因此有一个功能模式线性".
I'm using the Matlab function Y = WGN(M,N,P)
to generate white noise with Gaussian distribution. This function uses a power value (dB Watts) to calculate the amplitude of the output signal. Since I want to get an output amplitude range of -1 V to 1 V there is a function mode 'linear'.
我正在尝试使用线性"模式来产生输出,但结果是输出幅度范围为[-4 4]
I'm trying to use the 'linear' mode to produce the output but the result is an output amplitude range of [-4 4]
RandomSignal = wgn(10000,1,1,1,'linear');
Time = linspace(0,10,10000);
figure()
plot(Time,RandomSignal)
figure()
hist(RandomSignal,100)
是否还有另一个函数可以产生此结果,或者我只是做错了什么?
Is there another function to produce this result, or am I just doing something wrong?
推荐答案
正如其他人所说,您不能限制高斯分布. 您可以做的是将范围定义为6个标准差,然后使用randn(m,sigma)生成信号.
As others have said, you can't limit a Gaussian distribution. What you can do is define your range to be 6 standard deviations, and then use randn(m,sigma) to generate your signal.
例如,如果您想要范围为[-1 1],则将选择sigma = 2/6 = 0.333和Mu = 0.这将有99.7%的机会在该范围内.然后,您可以向上和向下舍入超出范围的数字.
For example if you want a range of [-1 1] you will choose sigma=2/6=0.333 and Mu=0. This will create a chance of 99.7% to be inside the range. You can then round up and down those numbers that are out of the range.
这不是纯高斯分布,但这是您可以获得的最接近的分布.
This will not be a pure Gaussian distribution, but this is the closest you can get.
这篇关于用Matlab产生幅度在[-1 1]之间的白噪声的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!