2
我想绘制以下累积分布函数使用np.piecewise为均匀分布
而要做到这一点,我想我可以用np.piecewise
如下
x = np.linspace(3, 9, 100)
np.piecewise(x, [x < 3, 3 <= x <= 9, x > 9], [0, float((x - 3))/(9 - 3), 1])
但这给出以下错误
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
如何我可以这样做吗?