samedi 31 janvier 2015

How can I implement complex normal Gaussian noise?

I want to implement complex normal Gaussian noise in python or C.


Fig.1 shows what I want to implement. Fig.1


And first I implement it in python, like this.



import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import pylab as pl

size = 100000
BIN = 70

x = np.random.normal(0.0,1.0,size)
y = np.random.normal(0.0,1.0,size)

xhist = pl.hist(x,bins = BIN,range=(-3.5,3.5),normed = True)
yhist = pl.hist(y,bins = BIN,range=(-3.5,3.5),normed = True)
xmesh = np.arange(-3.5,3.5,0.1)
ymesh = np.arange(-3.5,3.5,0.1)
Z = np.zeros((BIN,BIN))
for i in range(BIN):
for j in range(BIN):
Z[i][j] = xhist[0][i] + yhist[0][j]
X,Y = np.meshgrid(xmesh,ymesh)
fig = plt.figure()
ax = Axes3D(fig)
ax.plot_wireframe(X,Y,Z)
plt.show()


However, it is not complex Gaussian noise.


The output figure become Fig.2.Fig.2


I think Gaussian noises are addictive, however, why it become so different?


I already tried to change the parts of code



x = np.random.normal(0.0,1.0,size)
y = np.random.normal(0.0,1.0,size)


to



r = np.random.normal(0.0,1.0,size)
theta = np.random.uniform(0.0,2*np.pi,size)
x = r * np.cos(theta)
y = r * np.sin(theta)


however, the result was same.


Please tell me the correct implementation or equation of complex normal Gaussian noise.





Aucun commentaire:

Enregistrer un commentaire