Lab 6 & 7-EMG Signal Analysis
Lab 6 & 7-EMG Signal Analysis
I. Objective:
The objective of this assignment is to expose you to signal processing methods applied
for quantifying human performance by analyzing EMG signals for total muscle effort
over a given task. In particular, the bench press maneuver, which the subject performs, is
used as the basis of analysis. Specifically, the subject will perform the bench press
maneuver with two different weights, 5 and 10 lbs, performing three trials of the task for
each weight. As the subject performs the task, electromyographic (EMG) data is
recorded. The goal of the assignment is to find a significant difference in the data
between the 5 and 10 lb maneuvers.
1
The Bench Press Anatomy:
2
dipole traveling down a muscle fiber. That being said, if we place a pair of electrodes
close to or on an active muscle fiber, we should be able to measure a change in the
membrane potential.
Typically, differential operational amplifiers are used to measure the voltage difference
between electrodes A and B in ‘noisy’ environments. The operational amplifier’s output
voltage (Vout) will be proportional to the difference between electrodes B and A.
Differential voltage measurements are preferred because the relatively small magnitude
of the EMG signal at the surface of the skin (between 100 and 1000 microvolts) is on the
same order of magnitude as electrical noise in the environment. By taking the difference
between electrodes B and A, we would theoretically cancel out any noise common to
both electrodes. Realistically, there are hundreds and thousands of muscle fibers firing at
random intervals and since we are using surface electrodes, it becomes increasingly
difficult to separate activity of one motor unit from another. In general then, an EMG
signal is an indicator of the activity of several muscle fibers near the electrodes.
3
III. Signal Processing Concept:
The Raw EMG signal offers us valuable information in a practically useless form. It can
not be quantitatively compared between different subjects or even for the same subject if
the electrodes are moved between one recording and the other. As such, it is typical
protocol to render the raw EMG signal into a more suitable form. There are several ways
to process EMG and the methods chosen primarily depend on what information you want
out of the EMG. For the purpose of this assignment, we want a quantitative measure of
muscular effort required to lift either the 5lb or 10lb weights. In other words, if we could
sum up the activity of each muscle over the time it took to complete the experiment we
could get an estimate of the net (i.e. total) activity to complete the task. In order to do this
we integrate the area under the processed EMG signal. However, prior to taking the
integral, a series of common steps in processing EMG are taken. Namely, the signal is
first full-wave rectified and then passed through a Low-Pass filter, before finally being
integrated. Refer to the following flow chart when reading about the signal processing
steps below. The steps outlined below need to be implemented for each of the 3 trials for
each of the 2 weights. The final values that result from the following steps should be
input into the data tables provided in the document titled DataInputs.doc.
4
(1) The first mandatory step in processing the EMG signal is to remove the bias,
which is a low amplitude voltage offset, which can be AC or DC. The bias is
eliminated by subtracting the mean of the signal from the signal itself.
LINEAR ENVELOPE
The linear envelope is a 2-step process: rectification followed by low pass filtration. The
linear envelope provides the signal in a form that is easy to interpret and to detect the
onset of activity.
(2) Rectification: is an operation that converts a signal whose values are both positive
and negative into one that has only positive values. There are 2 types of rectification:
a. Half-wave Rectification: all negative data is discarded and only positive data is kept.
b. Full-wave Rectification: the absolute value of each data point is used.
(3) This stage is designated to smooth out the signal by removing higher frequency
components (i.e. Low Pass Filtration). There are two methods to do this:
5
Note: the Matlab function butter requests that you input the cutoff frequency as a value
normalized by half the sampling frequency. For example, a cutoff frequency of 10Hz
would be input as: 10Hz/ 0.5 *2000Hz = 0.
In order to compare the performance of filters of various cutoff frequencies, you will
create 3 different Butterworth low pass filters, each with a different cutoff frequency.
– Filter type: ‘Low’
Apply the filter you defined using butter by using the filter command:
filtered_signal=filter(b,a,signal)
Where b,a are the filter variables output by the butter function, and the signal you input is
the unbiased, full-wave rectified signal from part (2).
(4) Finally, the signal is integrated, i.e. the area under the curve of the smoothed-out
signal should be determined in order to produce a ‘final’ integrated (IEMG) value. This
value is a measure of the overall muscle effort that was exerted while performing the
bench-press task.
6
Remember that in Matlab, this integral is implemented by summing all the values of the
signal vector.
b. RMS Value
The RMS value represents the square root of the average power of the EMG signal for a
given period of time. It is calculated by:
The RMS measure is often preferred over the MA value because it provides a measure of
the power of the EMG signal while the MAV does not.
7
IV. Laboratory Protocol :
Data Preparation
Before getting started on the assignment you will need to successfully retrieve the data
and upload it into Matlab. The data you are given is a collection of trials, each trial
consisting of measurements from each of the 3 target muscle groups mentioned above.
You should have 6 data files in the .txt format. Opening the text file will help you
understand how the data is organized. There are three columns of data, each column
representing a muscle group EMG signal for a given trial using a given weight. Each file
name indicates the weight that was lifted and the trial number. For example, to load the
1st trial of the 5lb bench press, type the following command in Matlab:
load emg5_1.txt
You should now have a variable called ‘emg5_1’ in your Matlab workspace. Check the
size of your variable by using the following command:
size(emg5_1)
ans = 4000 3
Indicating that each data file contains 3 columns (1 column per muscle) with 4000 data
points per column. Since analysis will be done to compare the different muscle groups
during each trial, it is a good idea to separate this data file into 3 Matlab variables, each
variable representing a given muscle. We will continue to use the 1st trial of the 5lb bench
press as an example:
emg5_1pect=emg5_1(:,1);
emg5_1bicep=emg5_1(:,2);
emg5_1tricep=emg5_1(:,3);
8
You will have to repeat similar data preparation steps for the 2nd and 3rd trials of the 5lb
bench press as well as all three trials of the 10lb bench press.
Visualizing the Raw EMG Data: Now that the data has been separated into individual
files, it can be visualized to get a better understanding of what the signal we are working
with looks like. Use the plot command to generate a figure of the raw data. We begin
with the raw EMG signal seen in the figure below:
The Gain:
The first thing to note is that the recorded EMG voltage output is not what the electrodes
measure, but rather the signal coming from the electrodes is amplified by a gain factor G
by built-in circuitry located between the electrodes and the node from which Vout is read.
The signal plotted in the figure above has a maximal peak-to-peak value of
approximately 2.3V, although in reality the EMG signal had a maximum peak to peak of
460microVolts. Given this information, we can determine that the value of the gain factor
G is …………..
The Bias:
9
The next thing to notice about the figure is the small DC offset in the signal. The EMG
amplifiers cause a bias, in this case of about 0.06Volts. That is, if the electrodes were
connected to each other, the output would be 0.06 Volts. This bias can be determined by
taking the average of the raw signal. To account for this DC offset, we simply subtract it
from the recorded EMG signal. The following figure shows the unbiased version of the
above signal.
Now that the bias has been removed we are ready to begin analyzing the data. First, the
time frame of the recorded data needs to be defined. We know (from the data text files)
that the EMG data was collected at a sampling frequency of 2000Hz and that the total
number of data points for one recording of EMG is 4000 samples. Given this information,
we can conclude that the data was recorded for a total time of seconds and thus, a Matlab
time variable ‘t’ should be defined as follows:
t=[ : : ];
The following is the same unbiased data plot, but with time labels in the x-axis rather
than sample number label.
10
Advanced Signal Processing
Your task is to implement all the Signal Processing steps described in the Flow Chart
Sequence above on the EMG Data you have been provided using the MATLAB
environment. You will do so by writing a different function file for each of the signal
processing steps and then running all of these functions in a single .m file.
V. Coding Tip:
Helpful Hint: This assignment requires you to perform several signal processing steps
many times using different data. Thus, it is a good idea to make this easier & faster by:
– Creating a different function file for each signal processing step
e.g. unbias.m, movingaverage.m, butterfilter.m, etc
Write the function in such a way that the user can simply change the value of the
input variable when calling the function rather than by having to re-edit the
function each time.
– Create an .m file for each muscle trial (e.g. emg5_1_bicep.m) that includes all of the
above signal processing functions, so by running this .m file you’re able to execute all
processing steps at once.
VI. Plotting:
Generate a 4-subplot figure for each of the following scenarios:
I. EMG5_1_Pectoral: Unbiased : Full-Wave Rectified : LPF (10Hz) : Mean Absolute
Value
11
IV. EMG5_1_Pectoral: Unbiased : Full-Wave Rectified : LPF (50z) : RMS Value
13
Tricep: Trial 1: 5lb vs 10lb
(b) Thus, do the muscles exert more effort when lifting a 10lb vs 5lb weight.
14