Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import matplotlib.pyplot as plt
- def sigmoid(x,a,b):
- # sigmoid function with parameters a = center; b = width
- return 1/(1+np.exp(-(x-a)/b))
- # testing changing sigmoid width (and slope at the same time) - parameter b
- x = np.linspace(0,10,256)
- y = sigmoid(x,5,1) # default
- ymax = sigmoid(x,5,1.75)
- ymin = sigmoid(x,5,0.25)
- # Create the plot
- plt.plot(x,y,lw=2,color='black')
- plt.plot(x,ymax,lw=2,color='green')
- plt.plot(x,ymin,lw=2,color='orange')
- test=np.linspace(0,1,128)
- plt.plot(y2*255,test,lw=2,color='yellow')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement