# PERIODINDEX is the jRidges module of jLab.

``` PERIODINDEX  Returns time index in increments of instantaneous period.

INDEX=PERIODINDEX(DT,OMEGA,N) returns a time index INDEX that skips
every N times the instantaneous period 2*pi/OMEGA.

OMEGA is a column vector of instantaneous frequency in radians per unit
time as computed by INSTMOM. DT is the sample time, a scalar.  The
units of 2*pi/OMEGA should be the same as the units of DT.

Then PERIODINDEX constructs an index into a vector of the same length
as OMEGA that skips every N times the instantaneous period 2*pi/OMEGA.
Thus N=1 returns an index with one sample per period, etc.

The first and last N periods are omitted from the index.  Specifically,
the first value of INDEX is N times first value of 2*pi/OMEGA, and
the last value of INDEX is not larger than the length of OMEGA minus
N times the last value of 2*pi/OMEGA.

If NaNs are found within the OMEGA, this is interpreted as being
separate ridges output by RIDGEWALK.  Then INDEX will be a cell array
with the period index for each ridge of OMEGA in a separate cell.

INDEX=PERIODINDEX(OMEGA,N) also works, in which case DT is taken to be
as unity.  Thus OMEGA must have units of radians per sample interval.

PERIODINDEX is useful with ELLIPSEPLOT for plotting ellipses a
specified number of periods apart.
___________________________________________________________________

Cell array input / output

PERIODINDEX returns cell array output given cell array input.

That is, if OMEGA is a cell arrays of length K, containing K different
numerical arrays, then INDEX will also be cell arrays of length K.

In this case DT may be either a scalar, or an array of length K.

If the cells of OMEGA are found to contain NaNs, these are interpreted
as separating individual ridges, and INDEX will in this case be a cell
array of length OMEGA with each element containing one cell per ridge.
___________________________________________________________________

Usage: index=periodindex(dt,omega,N);
__________________________________________________________________
This is part of JLAB --- type 'help jlab' for more information
(C) 2011--2016 J.M. Lilly --- type 'help jlab_license' for details
```