【发布时间】:2020-04-23 08:14:16
【问题描述】:
我编写了一个绘制 sigmoid 函数的代码。代码非常简单而且很小。它也不会抛出任何错误。但是当我运行它时,我在图中得到一个白框而不是 S 形曲线。我无法理解我哪里出错了。请帮忙
import matplotlib.pyplot as plt
import math as mt
def sigmoid(x):
for i in range(10):
x = x + 0.1
sigmoid = (1/(1 + mt.exp(-x)))
return x, sigmoid
x, sig = sigmoid(0)
plt.plot(x, sig)
plt.show()
【问题讨论】:
-
@DeepSpace。那我应该写两次 plt.plot 吗?一个具有 x.arange 和 y.arange 值?其他带有 x 和 sig 的?
标签: python-3.x matplotlib math sigmoid