我想生成一个矢量,基本上是这样的 sin wave
带参数假设 amplitude range = [-1,1]
, time period = 2*pi
和 duration = 20 seconds
在baseR中有一个函数 sin(pi*x)
但我不知道如何使用它来获得所需的结果。
那..:
amplitude <- 1
period <- 2*pi
duration <- 20 # seconds
npoints <- 1000
t <- (0:(npoints-1)) * duration / (npoints - 1)
y <- sin( x * period / (2*pi))
plot(t,y,type='l')