<< pchips | FOSSEE_Signal_Processing_Toolbox | peak2rms >>

FOSSEE_Signal_Processing_Toolbox >> FOSSEE_Signal_Processing_Toolbox > peak2peak

# peak2peak

Compute the maximum-to-minimum difference (peak-to-peak).

### Syntax

    Y = peak2peak(X)
    Y = peak2peak(X, dim)

### Parameters

X:

  Real or complex-valued input vector or matrix.

dim:

  (optional) Dimension along which to compute the maximum-to-minimum difference.

### Description

The `peak2peak` function computes the difference between the maximum and minimum values in `X`. By default, it operates along the first non-singleton dimension of `X`. If the `dim` parameter is provided, the computation is performed along the specified dimension.

### Examples

    // Compute peak-to-peak difference for a vector:
    t = 0:0.001:1-0.001;
    x = cos(2 * %pi * 100 * t);
    y = peak2peak(x)

    // Compute peak-to-peak difference along a specific dimension:
    t = 0:0.001:1-0.001;
    x = (1:4)' * cos(2 * %pi * 100 * t);
    y = peak2peak(x, 2)

### Authors

- Rahul Dalmia
- Debdeep Dey

Report an issue
<< pchips | FOSSEE_Signal_Processing_Toolbox | peak2rms >>