Skip to content
Snippets Groups Projects
Commit 4aad9d2f authored by cprutean's avatar cprutean
Browse files

Upload New File

parent cd2aedbe
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id:0758d75a tags:
# Gaussian Noise Plot
%% Cell type:code id:f0193150 tags:
``` python
"""
Plot a histogram of Gaussian noise
"""
import math
import random
import matplotlib.pyplot as plt # Import the plot package as plt
def main():
point = 10000 # Number of points
gauss_data = [] # list to hold points
mean = 20.0 # mean of noise
sd = 2.0 # standard deviation of noise
while point >= 0: # Fill list with gauss randoms
gauss_data.append(random.gauss(mean,sd))
point -= 1
# Plot histogram with 40 bins and range of mean +/- 3sd
plt.hist(gauss_data, bins = 40, range = [mean - 3*sd , mean + 3*sd])
plt.title("Histogram of Gaussian Noise")
plt.show()
main()
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment