python 白噪声处理_如何在python(或numpy / scipy)中生成复杂的高斯白噪声信号?...

在数字信号处理中,需要生成复数高斯白噪声信号。可以通过numpy库来实现,例如使用numpy.random.randn生成实数序列,然后转换为复数。另外,还可以通过numpy.random.normal和numpy.random.multivariate_normal结合适当的比例和协方差矩阵来生成。确保生成的噪声信号的方差接近1,以符合高斯分布特性。
摘要由CSDN通过智能技术生成

I am doing some works about DSP(digital signal process), and there need to generate a discrete complex white gaussian noise signal. I know I can use numpy.random.normal(0, 1, n) to generate the discrete sequence, but it is in real number field. It is easy to simulate with Matlab, but I wander how to replace matlab code with python?

解决方案

Here's one way you can do it. This generates an array of standard normal variates of shape (n, 2), and then uses the .view() method to view the array as an array of complex values with shape (n,).

In [26]: n = 10

In [27]: z = np.random.randn(n, 2).view(np.complex128)

In [28]: z

Out[28]:

array([[ 0.90179497-0.14081956j],

[-2.17633115+0.88782764j],

[ 0.94807348+0.27575325j],

[-1.25452512+0.64883484j],

[-0.58886548+0.15419947j],

[ 0.58296574&#

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值