Running the following code:
import matplotlib.pyplot as plt
import numpy as np
def xon (ton, t):
if ton <= t:
return (t-ton)/5
else:
return 0
vxon = np.vectorize(xon)
t = np.linspace(0, 49, 50)
xontest = vxon(0, t)
plt.plot(t, xontest, '-')
plt.show()
But when I try to plot for values of ton, wchich are different than zero, e.g.:
xontest = vxon(2, t)
the plot seems to round all the xon values to integer:
What in my code causes such behaviour?