Advertisement
Guest User

Untitled

a guest
Sep 16th, 2014
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3.  
  4.  
  5. def sigmoid(x,a,b):
  6. # sigmoid function with parameters a = center; b = width
  7. return 1/(1+np.exp(-(x-a)/b))
  8.  
  9. # testing changing sigmoid width (and slope at the same time) - parameter b
  10. x = np.linspace(0,10,256)
  11. y = sigmoid(x,5,1) # default
  12. ymax = sigmoid(x,5,1.75)
  13. ymin = sigmoid(x,5,0.25)
  14. # Create the plot
  15. plt.plot(x,y,lw=2,color='black')
  16. plt.plot(x,ymax,lw=2,color='green')
  17. plt.plot(x,ymin,lw=2,color='orange')
  18.  
  19. test=np.linspace(0,1,128)
  20. plt.plot(y2*255,test,lw=2,color='yellow')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement