fwhm | R Documentation |
Compute peak full-width at half maximum or at another level of peak maximum for a vector or matrix.
fwhm(
x = seq_len(length(y)),
y,
ref = c("max", "zero", "middle", "min", "absolute"),
level = 0.5
)
x |
samples at which |
y |
signal to find the width of. If |
ref |
reference. Compute the width with reference to:
|
level |
the level at which to compute the width. Default: 0.5. |
Full width at half maximum, returned as a vector with a length equal
to the number of columns in y
, or 1 in case of a vector.
Petr Mikulik.
Conversion to R by Geert van Boxtel, G.J.M.vanBoxtel@gmail.com.
x <- seq(-pi, pi, 0.001)
y <- cos(x)
w <- fwhm(x, y)
m <- x[which.max(y)]
f <- m - w/2
t <- m + w/2
plot(x, y, type="l",
panel.first = {
usr <- par('usr')
rect(f, usr[3], t, usr[4], col = rgb(0, 1, 0, 0.4), border = NA)
})
abline(h = max(y) / 2, lty = 2, col = "gray")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.