Debian Codegraph @

docs/manual/vector_peak_interpolation.html

raw
1 <html><head><meta name="robots" content="index,follow"><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
2 <title>vector peak interpolation</title>
3 <style>
4 td { padding-left: 5pt; padding-right: 5pt; }
5 th { padding-left: 5pt; padding-right: 5pt; }
6 code { white-space: pre-wrap; }
7 dd { white-space: pre-wrap; }
8 </style>
9 </head><body bgcolor="#FFFFFF">
10
11 <table border=0 cellpadding=0 cellspacing=0><tr><td bgcolor="#CCCC00"><table border=4 cellpadding=9><tr><td align=middle bgcolor="#000000"><font face="Palatino,Times" size=6 color="#999900"><b>
12 vector peak interpolation
13 </b></font></table></table>
14 <p>An algorithm for finding a maximum or a minimum in a sampled signal.</p>
15 <h2>Overview</h2>
16 <p>The signal is described with the sequence <i>y</i><sub><i>i</i></sub>, <i>i</i> = 1...<i>n</i>, where <i>n</i> is the number of samples. Each sample <i>i</i> is associated with an <i>x</i> value (typically, time) given by <i>x</i><sub><i>i</i></sub> = <i>x</i><sub>1</sub> + (<i>i</i> - 1) <i>dx</i>, where <i>dx</i> is the sample period.</p>
17 <p>The maximum is looked for in two kinds of locations:</p>
18 <dl>
19 <dd style="position:relative;padding-left:1em;text-indent:-2em">1. At the left and right edge, i.e. at <i>i</i> = 1 and at <i>i</i> = <i>n</i>.</dd>
20 <dd style="position:relative;padding-left:1em;text-indent:-2em">2. At or <i>near</i> all local maxima, i.e. at or <i>near</i> those <i>i</i> that satisfy <i>y</i><sub><i>i</i>-1</sub> &lt; <i>y</i><sub><i>i</i></sub> &#8804; <i>y</i><sub><i>i</i>+1</sub>.</dd>
21 </dl>
22 <p>The greatest of the following values, therefore, will be the maximum:</p>
23 <dl>
24 <dd style="position:relative;padding-left:1em;text-indent:-2em">1. <i>y</i><sub>1</sub>.</dd>
25 <dd style="position:relative;padding-left:1em;text-indent:-2em">2. The local maxima, which are at or <i>near</i> <i>y</i><sub><i>i</i></sub>, where <i>y</i><sub><i>i</i>-1</sub> &lt; <i>y</i><sub><i>i</i></sub> &#8804; <i>y</i><sub><i>i</i>+1</sub>.</dd>
26 <dd style="position:relative;padding-left:1em;text-indent:-2em">3. <i>y</i><sub><i>n</i></sub>.</dd>
27 </dl>
28 <p>We will now see what <i>near</i> means. The precision of the result depends on the <i>interpolation method</i> of this algorithm.</p>
29 <h2>1. Lowest precision: round to sample</h2>
30 <p>If the interpolation method is &#8220;none&#8221;, the local maxima are <i>at</i> the samples <i>m</i> that satisfy <i>y</i><sub><i>m</i>-1</sub> &lt; <i>y</i><sub><i>m</i></sub> &#8804; <i>y</i><sub><i>m</i>+1</sub>. Thus, their <i>x</i> values are at <i>x</i><sub><i>m</i></sub> = <i>x</i><sub>1</sub> + (<i>m</i> - 1) <i>dx</i>, and their <i>y</i> values are <i>y</i><sub><i>m</i></sub>.</p>
31 <p>This kind of precision is appropriate for an unordered sequence of values <i>y</i><sub><i>i</i></sub>: the result is simply the greatest available value.</p>
32 <h2>2. Middle precision: parabolic interpolation</h2>
33 <p>If the interpolation method is &#8220;parabolic&#8221;, the algorithm uses one point on each side of every local maximum <i>y</i><sub><i>m</i></sub> to estimate the location and value of the local maximum. Because a Taylor expansion shows that any smooth curve can be approximated as a parabola in the vicinity of any local maximum, the location <i>x</i><sub><i>max</i></sub> and value <i>y</i><sub><i>max</i></sub> can be found with the following procedure:</p>
34 <table width="100%" style="white-space:pre-wrap"><tr><td align=middle><i>dy</i> &#8801; 1/2 (<i>y</i><sub><i>m</i>+1</sub> - <i>y</i><sub><i>m</i>-1</sub>)</table>
35 <table width="100%" style="white-space:pre-wrap"><tr><td align=middle><i>d</i><sup>2</sup><i>y</i> &#8801; (<i>y</i><sub><i>m</i></sub> - <i>y</i><sub><i>m</i>-1</sub>) + (<i>y</i><sub><i>m</i></sub>- <i>y</i><sub><i>m</i>+1</sub>)</table>
36 <table width="100%" style="white-space:pre-wrap"><tr><td align=middle><i>m</i>&#8242; &#8801; <i>m</i> + <i>dy</i>/<i>d</i><sup>2</sup><i>y</i></table>
37 <table width="100%" style="white-space:pre-wrap"><tr><td align=middle><i>x</i><sub><i>max</i></sub> = <i>x</i><sub>1</sub> + (<i>m</i>&#8242; - 1) <i>dx</i></table>
38 <table width="100%" style="white-space:pre-wrap"><tr><td align=middle><i>y</i><sub><i>max</i></sub> = <i>y</i><sub><i>m</i></sub> + 1/2 <i>dy</i><sup>2</sup> / <i>d</i><sup>2</sup><i>y</i></table>
39 <p>This kind of precision is appropriate if <i>y</i> is considered a smooth function of <i>x</i>, as in:</p>
40 <dl>
41 <dd style="position:relative;padding-left:1em;text-indent:-2em"><a href="Formant__Get_minimum___.html">Formant: Get minimum...</a></dd>
42 <dd style="position:relative;padding-left:1em;text-indent:-2em"><a href="Formant__Get_time_of_minimum___.html">Formant: Get time of minimum...</a></dd>
43 <dd style="position:relative;padding-left:1em;text-indent:-2em"><a href="Formant__Get_maximum___.html">Formant: Get maximum...</a></dd>
44 <dd style="position:relative;padding-left:1em;text-indent:-2em"><a href="Formant__Get_time_of_maximum___.html">Formant: Get time of maximum...</a></dd>
45 <dd style="position:relative;padding-left:1em;text-indent:-2em"><a href="Intensity__Get_minimum___.html">Intensity: Get minimum...</a></dd>
46 <dd style="position:relative;padding-left:1em;text-indent:-2em"><a href="Intensity__Get_time_of_minimum___.html">Intensity: Get time of minimum...</a></dd>
47 <dd style="position:relative;padding-left:1em;text-indent:-2em"><a href="Intensity__Get_maximum___.html">Intensity: Get maximum...</a></dd>
48 <dd style="position:relative;padding-left:1em;text-indent:-2em"><a href="Intensity__Get_time_of_maximum___.html">Intensity: Get time of maximum...</a></dd>
49 </dl>
50 <h2>3. Higher precision: cubic interpolation</h2>
51 <p>If the interpolation method is &#8220;cubic&#8221;, the interpolation is performed over four points (see <a href="vector_value_interpolation.html">vector value interpolation</a>). The results are similar to those of the parabolic interpolation method, but you can use it (or sinc interpolation) if you want the result of a command like <b>Get maximum...</b> to be equal to the result of a sequence of commands like <b>Get time of maximum...</b> and <b>Get value at time...</b>.</p>
52 <h2>4. Highest precision: sinc interpolation</h2>
53 <p>If the interpolation method is &#8220;sinc70&#8221; or &#8220;sinc700&#8221;, the algorithm assumes that the signal is a sum of sinc functions, so that a number of points (namely, 70 or 700) on each side of the initial guess <i>m</i> must be taken into account (see <a href="vector_value_interpolation.html">vector value interpolation</a>). The algorithm finds the maximum of this continuous function by Brent's method (see <a href="Press_et_al___1992_.html">Press et al. (1992)</a>).</p>
54 <p>This method is appropriate for signals that result from sampling a continuous signal after it has been low-pass filtered at the <a href="Nyquist_frequency.html">Nyquist frequency</a>. See:</p>
55 <dl>
56 <dd style="position:relative;padding-left:1em;text-indent:-2em"><a href="Sound__Get_minimum___.html">Sound: Get minimum...</a></dd>
57 <dd style="position:relative;padding-left:1em;text-indent:-2em"><a href="Sound__Get_time_of_minimum___.html">Sound: Get time of minimum...</a></dd>
58 <dd style="position:relative;padding-left:1em;text-indent:-2em"><a href="Sound__Get_maximum___.html">Sound: Get maximum...</a></dd>
59 <dd style="position:relative;padding-left:1em;text-indent:-2em"><a href="Sound__Get_time_of_maximum___.html">Sound: Get time of maximum...</a></dd>
60 <dd style="position:relative;padding-left:1em;text-indent:-2em"><a href="Sound__Get_absolute_extremum___.html">Sound: Get absolute extremum...</a></dd>
61 </dl>
62 <h3>Links to this page</h3>
63 <ul>
64 <li><a href="Harmonicity__Get_maximum___.html">Harmonicity: Get maximum...</a>
65 <li><a href="Harmonicity__Get_minimum___.html">Harmonicity: Get minimum...</a>
66 <li><a href="Harmonicity__Get_time_of_maximum___.html">Harmonicity: Get time of maximum...</a>
67 <li><a href="Harmonicity__Get_time_of_minimum___.html">Harmonicity: Get time of minimum...</a>
68 <li><a href="Ltas__Get_frequency_of_maximum___.html">Ltas: Get frequency of maximum...</a>
69 <li><a href="Ltas__Get_frequency_of_minimum___.html">Ltas: Get frequency of minimum...</a>
70 <li><a href="Ltas__Get_maximum___.html">Ltas: Get maximum...</a>
71 <li><a href="Ltas__Get_minimum___.html">Ltas: Get minimum...</a>
72 <li><a href="PowerCepstrogram__Get_CPPS___.html">PowerCepstrogram: Get CPPS...</a>
73 <li><a href="PowerCepstrum__Get_peak_prominence___.html">PowerCepstrum: Get peak prominence...</a>
74 <li><a href="PowerCepstrum__Get_peak___.html">PowerCepstrum: Get peak...</a>
75 <li><a href="PowerCepstrum__Get_quefrency_of_peak___.html">PowerCepstrum: Get quefrency of peak...</a>
76 </ul>
77 <hr>
78 <address>
79 <p>© ppgb 20200912 20250418</p>
80 </address>
81 </body>
82 </html>