Skip to content

Instantly share code, notes, and snippets.

@luxedo
Created April 19, 2016 00:04
Show Gist options
  • Save luxedo/c208d829891fb984eb837c8e552abf63 to your computer and use it in GitHub Desktop.
Save luxedo/c208d829891fb984eb837c8e552abf63 to your computer and use it in GitHub Desktop.
'''
A few gaussian curves
'''
import matplotlib.pyplot as plt
import numpy as np
def gaussian(a, b, c, d, x):
'''
Gaussian function
'''
return a*np.exp(-((x-b)**2)/(2*c**2)) + d
print(gaussian(1, 2, 3, 4, 5))
X = np.linspace(-10, 10)
Y = [gaussian(1, -5, 5, 1, x) for x in X]
plt.plot(X, Y)
Y = [gaussian(2, 0, 1, 1, x) for x in X]
plt.plot(X, Y)
Y = [gaussian(2, 2, 1, 2, x) for x in X]
plt.plot(X, Y)
plt.legend()
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment