localmin: calculate a local minimum

Description Usage Arguments Details Value Author(s) References Examples

Description

The function calculates a local minimum of the vector x surrounded by at least n.points higher numbers.

Usage

1
localmin(x, n.points = 2)

Arguments

x

a vector of numbers.

n.points

a minimum number of higher values to determine the local minimum (see Details). Default is two points.

Details

The function calculates a local minimum of the vector x, i.e. the lowest value of the vector x surrounded by at least n higher numbers. The concept of the local minimum applied to ERP analysis is taken from Luck (2005).

Value

The local minimum of the vector x is returned.

Author(s)

Giorgio Arcara

References

Luck, S., J. (2005). An Introduction to the Event-Related Potential Technique. Cambridge, Mass.: The MIT Press.

Examples

1
2
3
4
x=seq(-5.5,1,0.001)
y=-(sin(x)+0.3*x)
plot(x,y, type="l")
abline(h=localmin(y)) #print an horizontal line intersecting the local minimum

erpR documentation built on June 7, 2019, 3 a.m.