Skip to content

vlt.signal.fwhm

 vlt.signal.fwhm Computes peak location (X-value) and full width at half maximum (FWHM).

    [peakLocation, fWidth, low_cutoff, high_cutoff, peakValue] = vlt.signal.fwhm(X, Y)

    Examines the data vector Y with corresponding X-axis labels X (e.g., time,
    frequency) to find the location of the peak value on the X-axis and the
    full width at half maximum (FWHM).

    Inputs:
      X           (Nx1 double) - Column vector of X-axis values.
      Y           (Nx1 double) - Column vector of corresponding Y-axis data values.

    Outputs:
      peakLocation (double)     - The X value where the maximum value of Y occurs.
      fWidth      (double)     - The full width at half maximum height (high_cutoff - low_cutoff).
                                 Returns Inf if the data does not drop below half height
                                 on either side of the peak.
      low_cutoff  (double)     - The interpolated X value on the falling edge (X < peakLocation)
                                 where Y crosses 0.5 * peakValue. Returns -Inf if Y
                                 never drops below this threshold before the peak.
      high_cutoff (double)     - The interpolated X value on the rising edge (X > peakLocation)
                                 where Y crosses 0.5 * peakValue. Returns Inf if Y
                                 never drops below this threshold after the peak.
      peakValue   (double)     - The maximum value found in Y (optional output).

    Details:
      - Finds the maximum value (peakValue) and its index (peakIndex) in Y.
      - Determines the X-axis location of the peak (peakLocation = X(peakIndex)).
      - Calculates the half-height threshold (0.5 * peakValue).
      - Searches backwards from the peak to find the first point below the threshold.
      - Searches forwards from the peak to find the first point below the threshold.
      - Linearly interpolates between the points immediately above and below the
        threshold on both sides to find the exact X cutoff values.

    See also: MAX, FIND, INTERP1