I want to extract frequency domain features for my machine learning model, and to do so I have calculated the power spectrum of the EMG signal. One of my first questions is that my frequency is just 94Hz, hence some movements just have 70 samples after the noise has been cropped.

def power_spectrum(t, y):
n= len(t)                      
sampling_rate = 1/(t[1]-t[0]) 
sampling_rate = 1/(t[1]-t[0])    
ffty = np.fft.fft(y)/np.sqrt(n) 
freq = np.fft.fftfreq(N,1/sampling_rate

return freq[1:int(n/2)],(2 * np.abs(ffty)**2/sampling_rate)[1:int(n/2)]

Above is the code that I am using to extract the power spectrum. I wanted to extract the power spectrum, the max frequency, the mean frequency, the frequency variance and the peak frequency, however, I am unsure if the calculus are correct. I am using just this part of the code to calculate the frequency: freq = np. fft.fftfreq(N,1/sampling_rate.

I have not been able to plot the results hence this approach might be totally wrong.

Here is a link to one EMG signal sample https://1drv.ms/x/s!AozFSviQwFGvgvwaeDL6tDfarnLF9g?e=FhKBMF


1 Answer 1


Sorry, but it'll be very difficult to extract anything useful from this data.

  1. It has a very large bias
  2. It has very high quantization noise. The Signal to Noise ratio is maybe 12 dB (at best).
  3. It's too short for any reasonable spectral analysis
  4. It looks under-sampled, but that's hard to tell.

You can try remove the bias, window and FFT it, but noise will be very high the frequency resolution quite poor.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.