在matlab中生成随机噪声
当我向数组添加高斯噪声时,直方图不应该是高斯的吗?虽然噪声是随机的,但分布应该是高斯分布,对吗?那不是我得到的。
A=zeros(10);
A=imnoise(A,'gaussian');
imhist(A)
When I add Gaussian noise to an array shouldnt the histogram be Gaussian? Although the noise is random, the distribution should be gaussian right? That is not what I get.
A=zeros(10);
A=imnoise(A,'gaussian');
imhist(A)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这就是你的代码正在做的事情:
你能看出问题出在哪里吗? (提示:RANDN 返回数字
~N(0,1)
,因此最终添加的噪声为~N(mu,sd)
)也许您想要做的是:
This is what your code is doing:
can you see where the problem is? (Hint: RANDN returns number
~N(0,1)
, thus the resulting added noise is~N(mu,sd)
)Perhaps what you are trying to do is:
imnoise() 是一个可以应用于图像的函数,而不是普通数组。
也许您可以查看 randn() 函数。
imnoise() is a function that can be applied to images, not plain arrays.
Maybe you can look into the randn() function, instead.
您可能看不到采样框仅为 10 的钟形曲线。
请参阅中心极限定理。
http://en.wikipedia.org/wiki/Central_limit_theorem
我会尝试增加采样框架到更大的东西。
参考:
大数定律
http://en.wikipedia.org/wiki /大数法则
You might not see a bell-curve with a sampling frame of only 10.
See the central limit theorem.
http://en.wikipedia.org/wiki/Central_limit_theorem
I would try increasing the sampling frame to something much larger.
Reference:
Law of Large Numbers
http://en.wikipedia.org/wiki/Law_of_large_numbers
可能会发生两件事:
您没有足够的样本量,或者
高斯分布的无噪声的默认均值是0,意味着您只能看到钟形曲线的右半部分。
尝试
Two things could be going on:
You don't have enough of a sample size, or
The default mean of imnoise with gaussian distribution is 0, meaning you're only seeing the right half of the bell curve.
Try