Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import matplotlib.pyplot as plt
- def exp2lin(x):
- # convert exponential values to linear ones
- epsilon = 1 - np.fabs(x).min()
- return np.sign(x) * np.log10( epsilon + np.fabs(x) )
- X = np.linspace(-3,3,1000)
- Y = np.concatenate([-np.logspace(3,-0.01,500), np.logspace(-0.01,3,500)])
- Y_hat = exp2lin(Y)
- #plt.scatter(X, Y, s=1, color="blue")
- plt.scatter(X, Y_hat, s=1, color="green")
- plt.show()
Add Comment
Please, Sign In to add comment