Description Usage Arguments Value Examples
The derivative are approximated by the slope of a linear fit to the data in a window of a given radius width.
1 |
X |
a matrix on the form [1 z Force], |
width |
radius of the window for the local regression (in vector position units) |
A vector containing the derivatives.
1 2 3 4 5 6 7 8 9 | n <- 100
x <- seq(0, 2 * pi, length.out = n)
y = sin(x) + 0.1 * rnorm(n)
X <- matrix(c(rep(1, n), x, y), nrow = n, ncol = 3)
width <- 5
b <- CalcSlope(X, width)
plot(x[(width + 1) : (n - width)], b, xlab = "x", ylab = "y", type = "l")
lines(x, y, col = "red")
legend("bottomleft", c("Slopes","Signal"), col = c(1, 2), lty = 1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.