Since the other answer does not implement the function in the question, here is a correct soluton:
import numpy as np
import matplotlib.pyplot as plt
x= np.linspace(0., 50., 1001)
f = lambda x0, x1: np.piecewise(x, [x < x0, (x >= x0) & (x <= x1), x > x1],
[0., lambda x: x/x0, 1.])
plt.plot(x, f(10, 30))
plt.show()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.