## Peak-to-peak intervals

Purpose
Description
Example
Tips
Macro Synopsis
Modules
Related Functions

### Purpose

Calculate intervals between successive peaks of a signal

### Description

This function calculates the intervals between successive peaks/spikes in a signal and returns them as a new time series. Parameters are:
• window wsize : size (in x-units) of the window to be slided along the signal;
This parameter determines the minimum distance of two successive peaks to be detected: Setting this value higher leads to the loss of neighbored smaller peaks. Therefore the window criterion can be used to filter out unwanted secondary peaks. Setting this value to 0 turns off windowing, thus considering all peaks in the signal.
• the type of peaks peaktype, which is either
• "Maxima" (0) or
• "Minima" (1)
• crossing, which means the choice whether a threshold crossing between peaks is
• "not checked" (0) or
• "checked" (1),
If this is turned on (1), the function only detects a peak if the threshold line has crossed by the signal after the previous peak.
• the threshold value thresh, meaning that only maxima (minima) above (below) this threshold are detected; set this value higher (lower) to omit local extrema;
• axistype, determining the type of x-axis for the output, either
• "Time" (0) - The peak intervals are plotted over the continuous time axis or
• "Beats" (1) - The peak intervals are plotted against the number of peaks.

The total number of peaks detected by "Peak-to-peak intervals" will appear in the message window.

### Example

"Peak-to-peak intervals" is useful to detect rhythms and deviations from periodicity in a signal showing peaks or iterated patterns. Try applying the function to the sample data file ecg.dpa.

### Tips

Set window size to 0 if no windowing is needed. Note, however, that in most cases windowing will be handsome to eliminate small intermediate peaks that accompany the dominant peaks to be extracted.

### Macro Synopsis

y = PeakToPeakIntervals(x,ws,peaktype,crossing,thresh,axistype);
signal x,y;
float ws;
option peaktype, crossing;
float thresh;
option axistype;

Nonlinear

### Related Functions

Post event scan, Post event time histogram, Synchronicity histogram.