Learn R Programming

breakage (version 1.1-1)

find.bottom: Identify the bottom points in a hopping-mode position trace

Description

Identifies the bottom points of each approach in a positional trace from a scanning ion conductance probe operating in hopping mode.

Usage

find.bottom(x, window = 50, box.size = 9, clip.ends=TRUE)

Arguments

x
A vector of positions recorded over time. Positions are taken to be measured upward, i.e. a higher value corresponds to a higher probe position further from the sample. Units are unspecified.
window
Minimum number of previous descending points before a bottom point is accepted. This allows positional wobbles at the bottom and top of a hop to be ignored.
box.size
Width (in samples) of a simple box filter to apply in order to smooth the signal before searching for minima.
clip.ends
Whether to omit bottom points discovered within window points from the end of the signal. This avoids mis-identifying a de facto minimum at the end of the signal as being an actual bottom point. TRUE by default.

Value

A logical vector the same length as the input vector x, with the bottom points set to TRUE and all others FALSE.

Examples

Run this code
# use a simple sine wave as an example signal
t <- 1:1000
hops <- sin(t * pi/100)

# find the bottom points
bots <- find.bottom(hops)

# plot the result
plot(hops, type="l")
abline(v=t[bots], col=2)

Run the code above in your browser using DataLab