## ocdr

Estimate the forward speed of a flying or diving animal

## Syntax

#### Matlab & Octave

s=ocdr(p,A) p and A are sensor structures or s=ocdr(p,A,fc) p and A are sensor structures or s=ocdr(p,A,fc,plim) p and A are sensor structures or s=ocdr(p,A,fs) p and A are vectors/matrices or s=ocdr(p,A,fs,fc) p and A are vectors/matrices or s=ocdr(p,A,fs,fc,plim) p and A are vectors/matrices

#### R

s<-ocdr(p,A) p and A are sensor lists or s<-ocdr(p,A,fc) p and A are sensor lists or s<-ocdr(p,A,fc,plim) p and A are sensor lists or s<-ocdr(p,A,fs) p and A are vectors/matrices or s<-ocdr(p,A,fs,fc) p and A are vectors/matrices or s<-ocdr(p,A,fs,fc,plim) p and A are vectors/matrices

## Description

Estimate the forward speed of a flying or diving animal by first computing the altitude or depth-rate (i.e., the first differential of the pressure in meters) and then correcting for the pitch angle. This is called the Orientation Corrected Depth Rate. There are two major assumptions in this method: (i) the animal moves in the direction of its longitudinal axis, and (ii) the frame of A coincides with the animal's axes.

## Inputs

Input var | Description | Units | Default value |
---|---|---|---|

p | is the depth or altitude vector (a regularly sampled time series) sampled at fs Hz | meters | N/A |

A | is a nx3 acceleration matrix with columns [ax ay az]. Acceleration can be in any consistent unit, e.g., g or m/s^{2}. | g or m/s^{2} | N/A |

fs | is the sampling rate of p and A in Hz (samples per second). fs is not required if p and A are sensor structures. | Hz | N/A |

fc (optional) | specifies the cut-off frequency of a low-pass filter to apply to p after computing depth-rate and to A before computing pitch. The filter cut-off frequency is in Hz. The filter length is 4*fs/fc. Filtering adds no group delay. If fc is empty or not given, the default value of 0.2 Hz (i.e., a 5 second time constant) is used. | Hz | 0.2 |

plim (optional) | specifies the minimum pitch angle in radians at which speed can be computed. Errors in speed estimation using this method increase strongly at low pitch angles. To avoid estimates with poor accuracy being used in later analyses, speed estimates at low pitch angles are replaced by NaN (not-a-number). The default threshold for this is 20 degrees. | radians | 20 |

## Outputs

Output var | Description | Units |
---|---|---|

s | is the forward speed estimate | m/s |

## Notes & assumptions

- A must have the same number of rows as p.
- Output sampling rate is the same as the input sampling rate so s has the same size as p.
- Frame: This function assumes a [north,east,up] navigation frame and a [forward,right,up] local frame. In these frames, a positive pitch angle is an anti-clockwise rotation around the y-axis. A descending animal will have a negative pitch angle.

## Example

### Matlab & Octave

The example below uses data from the file testset2.nc. You can download it from the animaltags website's example data sets. If the file is saved in your current working directory, load it via:

testset2 = load_nc(‘testset2.nc’)

s = ocdr(testset2.P.data, testset2.A.data, testset2.P.sampling_rate) plott(s, testset2.P.sampling_rate)

### R

The example below uses data from the file testset2.nc. You can download it from the animaltags website's example data sets. If the file is saved in your current working directory, load it via:

testset2 <- load_nc(‘testset2.nc’)

s <- ocdr(p = testset2$P$data, A = testset2$A$data, fs = testset2$P$sampling_rate, fc = NULL, plim = NULL) speed <- list(s = s) plott(speed, testset2$P$sampling_rate)

## About

bugs@animaltags.org Last modified: 25 July 2017