This example uses a sinusoidal signal with amplitude varying sinusoidally in the range of [1,5] with a frequency of 63 Hz, and frequency varying according to a cosine function in the range of [10, 100] Hz with a frequency of 77 Hz.
Note that signalExtrema1 doesn't find the extrema exactly since sampling frequency 100 Hz is too small compared to maximum frequency of the input signal, whereas signalExtrema2 catches the extrema rather good due to the fact that sampling frequency 10 kHz is high enough.