在 Mathematica 中绘制 sigmoid 函数

Plotting sigmoid function in mathematica

我是 Mathematica 新手。

我想编写自己的 sigmoid 函数,我可以在其中为 ex 提供系数。绘图时,我没有得到任何输出,可能是什么问题?

sigmoid_f[x_, a_, b_] := 1/(1 + ae^-bx)
Plot[sigmoid_f[x, 1, 1], {x, -5, 5}]

感谢您的帮助!

我希望你写的时候

sigmoid_f[x_, a_, b_] := 1/(1 - ae^-bx)

你的意思是写

sigmoidf[x_, a_, b_] := 1/(1 - a*E^(-b*x))

其中 E 是欧拉数的内置表示,* 是乘法运算符的常用文本形式。

此外,正如@Alan 评论的那样,不要在您定义的对象的名称中使用 _

Mathematica 对大小写和标点符号非常讲究。在您的原始表达式中 aebx 都是(可能是未知的)对象的名称。