无法在指数衰减函数中输入"e"

use*_*569 2 r

我必须编写一个程序来模拟指数增长.我输入以下作为我的公式:

expDecay<-function(time,A=3,B=4,k=5){return(A*e^(-k*time)+B)}
Run Code Online (Sandbox Code Playgroud)

但是,R不断返回以下消息:

错误:找不到对象'e'

有没有办法解决这个问题?我错了吗?

nog*_*pes 6

使用exp().在你的情况下,exp(-k*time).