<?xml version="1.0" encoding="UTF-8"?>

<!--
 *
 * This help file was generated from findpeaks.sci using help_from_sci().
 *
 -->

<refentry version="5.0-subset Scilab" xml:id="findpeaks" xml:lang="en"
          xmlns="http://docbook.org/ns/docbook"
          xmlns:xlink="http://www.w3.org/1999/xlink"
          xmlns:svg="http://www.w3.org/2000/svg"
          xmlns:ns3="http://www.w3.org/1999/xhtml"
          xmlns:mml="http://www.w3.org/1998/Math/MathML"
          xmlns:scilab="http://www.scilab.org"
          xmlns:db="http://docbook.org/ns/docbook">

  <refnamediv>
    <refname>findpeaks</refname>
    <refpurpose>Find peaks in a signal.</refpurpose>
  </refnamediv>


<refsynopsisdiv>
   <title>Syntax</title>
   <synopsis>
   [pks, loc] = findpeaks(data)
   [pks, loc, extra] = findpeaks(data)
   [pks, loc, extra] = findpeaks(data, "PropertyName", PropertyValue)
   [pks, loc, extra] = findpeaks(data, "DoubleSided")
   
   </synopsis>
</refsynopsisdiv>

<refsection>
   <title>Parameters</title>
   <variablelist>
        <varlistentry>
            <term>data:</term>
            <listitem><para> Vector. The input signal to analyze. Must be a single column vector with at least 3 elements.</para></listitem>
        </varlistentry>
        <varlistentry>
            <term>pks:</term>
            <listitem><para> Vector. The values of the peaks in the input signal.</para></listitem>
        </varlistentry>
        <varlistentry>
            <term>loc:</term>
            <listitem><para> Vector. The indices of the peaks in the input signal.</para></listitem>
        </varlistentry>
        <varlistentry>
            <term>extra:</term>
            <listitem><para> Structure. Contains additional information about the peaks:</para></listitem>
        </varlistentry>
        <varlistentry>
            <term>- "parabol":</term>
            <listitem><para> Structure containing the parabola fitted to each peak.</para></listitem>
        </varlistentry>
        <varlistentry>
            <term>- "height":</term>
            <listitem><para> Estimated height of the peaks.</para></listitem>
        </varlistentry>
        <varlistentry>
            <term>- "baseline":</term>
            <listitem><para> Baseline height at which the roots of the peaks were calculated.</para></listitem>
        </varlistentry>
        <varlistentry>
            <term>- "roots":</term>
            <listitem><para> Abscissa values at which the parabola fitted to each peak realizes its width.</para></listitem>
        </varlistentry>
        <varlistentry>
            <term>Property-Value Pairs:</term>
            <listitem><para> </para></listitem>
        </varlistentry>
        <varlistentry>
            <term>- "MinPeakHeight":</term>
            <listitem><para> Minimum peak height (non-negative scalar). Default is `eps`.</para></listitem>
        </varlistentry>
        <varlistentry>
            <term>- "MinPeakDistance":</term>
            <listitem><para> Minimum separation between peaks (positive integer). Default is 1.</para></listitem>
        </varlistentry>
        <varlistentry>
            <term>- "MinPeakWidth":</term>
            <listitem><para> Minimum width of peaks (positive integer). Default is 1.</para></listitem>
        </varlistentry>
        <varlistentry>
            <term>- "MaxPeakWidth":</term>
            <listitem><para> Maximum width of peaks (positive integer). Default is `Inf`.</para></listitem>
        </varlistentry>
        <varlistentry>
            <term>- "DoubleSided":</term>
            <listitem><para> Indicates that the data contains both positive and negative values. The baseline is taken as the mean value of the data.</para></listitem>
        </varlistentry>
   </variablelist>
</refsection>

<refsection>
   <title>Description</title>
   <para>
This function identifies peaks in the input signal `data`. Peaks are defined as local maxima for positive data or maxima/minima for double-sided data. The function supports additional options to filter peaks based on height, distance, and width.
   </para>
   <para>
</para>
</refsection>

<refsection>
   <title>Examples</title>
   <programlisting role="example"><![CDATA[
// Find peaks in a simple signal:
data = [1, 3, 2, 5, 1]
[pks, loc] = findpeaks(data)

// Find peaks with a minimum height:
data = [1, 3, 2, 5, 1]
[pks, loc] = findpeaks(data, "MinPeakHeight", 3)

// Find peaks in double-sided data:
data = [1, -3, 2, -5, 1]
[pks, loc] = findpeaks(data, "DoubleSided")

   ]]></programlisting>
</refsection>
</refentry>
