Automate the length of samples in the envelope function to get the optimal peak envelope from various signals
1 view (last 30 days)
Shiva Vikram Bhagavatula on 16 May 2023
The optimal extraction of peak envelope with the 'envelope' function (https://nl.mathworks.com/help/signal/ref/envelope.html) necessitates the optimal selection of the sample length ("The envelopes are determined using spline interpolation over local maxima separated by at least np samples."). While manual optimization of the length is the most common route, it does not allow a rapid and accurate envelope extraction from different types of signals (with different time - frequency relationships). Is there a way to automate the selection of sample length for obtaining the optimal envelope? How to describe the optimal peak envelope (one definition would be touching all the peaks with minimal difference)?
Star Strider on 17 May 2023
Consider first using either findpeaks or islocalmax with find, and then calculate the appropriate distances (using min, max, mean, median or some other metric on the differences of the peak locations) to get the appropriate parameter for the second envelope argument. This is likely easiest, although another option would be to calculate the one-sided fft, find the peaks of the absolute values, and then calculate the inverse of the frequency at that peak location.