# Automatic activity detection using Hilbert transform

Jiro's pick this week is "Automatic enveloping, variance change and activity detection with Hilbert Transform" by Hooman Sedghamiz. This entry by Hooman brought back memories from my graduate school days. Back then, I was involved with experimental biomechanics. One of the types of measurements I took was EMG (electromyography), which represents muscle activity. Depending on the quality and the placement of the sensors, the measured signals can vary greatly in quality. From the EMG, I needed to determine the frequency and the duration of the muscle activations. Back then, I investigated a few different methods, ranging from manual inspection to using signal processing techniques with wavelets. That was when I really got to learn and use the Wavelet Toolbox. This function by Hooman would have certainly helped me with this task. It uses Hilbert transform, smoothing, and adaptive thresholding to identify the activations of the signal. The function has a few parameters you can specify:
• (2nd input) Smoothing window length
• (3rd input) Whether or not to use adaptive thresholding
• (4th input) Minimum number of samples where the signal needs to stay above the threshold in order to be considered active
• (5th input) Whether or not to create a summary plot
load data

act = envelop_hilbert_v2(sig,20,true,20,false);

plot(sig)
hold on
plot(act,'r')
legend('Raw signal','Activations')