Detect spectrum from a signal
4 views (last 30 days)
Show older comments
Hi, I want to detect the complete lenght of a signal spectrum. How can I know the beginning and the end? It's because the signal is not always on the center of the file. I want to calculate it as show the image Thanks
Answers (1)
Star Strider
on 20 May 2016
To define the ‘outline’ of your EMG signal, I would use the R2015b and later envelope function to create the envelope of the waveform, abs(hilbert(emg)) (which is the same thing in earlier releases), or a bandpass (or lowpass) discrete filter.
To design the filter, first do the fft of your signal to find the frequencies of interest, then design the filter using any of the several MATLAB Signal Processing Toolbox functions. My filter design procedure is here: How to design a lowpass filter for ocean wave data in Matlab? You will have to adjust the filter passband and stopband frequencies until you get the result you want.
Any of these will give you the EMG signal envelope. You then simply need to threshold that result to define the beginning and end of your EMG burst.
2 Comments
Star Strider
on 23 May 2016
My pleasure.
The envelope and hilbert functions have parameters you can adjust to give you the result you want, which is the ‘outline’ of your EMG data burst. The vector lengths they return will be the same size as the input vector regardless. To detect the onset and end of your EMG bursts, you would simply need to test for the threshold of the returned vectors of the envelope or hilbert calls. The find function is probably best for this, since it will pick up both the beginning and end values. Experiment with it to get the result you want.
Please plot the results of the envelope or hilbert calls with your data. The plots will tell you what the functions are doing.
I do not have your data, so I cannot be more specific.
See Also
Categories
Find more on Spectral Measurements in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!