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()
如何我可以這樣做嗎?