Calculate the derivative of a data-function in r

前端 未结 4 1713
忘了有多久
忘了有多久 2020-12-17 05:08

Is there an easy way to calculate the derivative of non-liner functions that are give by data?

for example:

x = 1 / c(1000:1)

y = x^-1.5
ycs = cumsu         


        
4条回答
  •  臣服心动
    2020-12-17 05:22

    There is also gradient from the pracma package.

    grad <- pracma::gradient(ycs, h1 = x)
    plot(grad, col = 1)
    

提交回复
热议问题