This function is used to estimate the vertical velocity by differentiating a depth or altitude time series. A low-pass filter reduces the sensor noise that is amplified by the differentiation.

depth_rate(p, fs, fc)

Arguments

p

A vector of depth or altitude data, or an animaltags list object containing depth or altitude data.

fs

(required only if p is a vector) is the sampling rate of p in Hz.

fc

(optional) A smoothing filter cut-off frequency in Hz. If fc is not given, a default value is used of 0.2 Hz (5 second time constant).

Value

v, The vertical velocity with the same sampling rate as p. v is a vector with the same dimensions as p. The unit of v depends on the unit of p. For example, if p is in meters, v is in meters/second

Note

The low-pass filter is a symmetric FIR with length 4fs/fc. The group delay of the filters is removed.

Examples

if (FALSE) {
v <- depth_rate(p = beaked_whale$P)
plott(list(beaked_whale$P$data, v),
  fs = beaked_whale$P$sampling_rate,
  r = c(1, 0), panel_labels = c("Depth\n(m)", "Vertical Velocity\n(m/s)")
)
# plot of dive profile and depth rate
}