Description Usage Arguments Author(s) See Also Examples
Taper constraints using simple derivatives
1 2 3 4 5 6 7 | ctap_simple(tapvec, ...)
## S3 method for class 'tapers'
ctap_simple(tapvec, ...)
## Default S3 method:
ctap_simple(tapvec, maxslope = 1L, ...)
|
tapvec |
integer or |
... |
optional arguments |
maxslope |
integer; constrain based on this maximum first difference |
A.J. Barbour
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # generate some random taper series and constrain them based on slopes
set.seed(1237)
n <- 11
x <- seq_len(n)
xn <- round(runif(n,1,n))
xnf <- ctap_simple(xn, 0) # flattens out
xnc <- ctap_simple(xn, 1) # no change, already only slopes = 1
try(all.equal(xnc, xn))
xnc2 <- ctap_simple(xn, 2) # slopes = 2 only
plot(xn, type='b', pch=16, ylim=c(0,12))
grid()
abline(a=0,b=1, col='red', lty=3); abline(a=0,b=2, col='blue', lty=3)
lines(xnf, type='b', col='green')
lines(xnc, type='b', col='red')
lines(xnc2, type='b', col='blue')
lines(0.2+as.vector(psd::ctap_simple(psd::as.tapers(xn))), type='b', pch=".", col='salmon')
# more examples:
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.