ELEC7901 Laboratory Report: Electrical Biosignals (20%)   
Due: 17 Apr 20 18:00  
This task will assess a range of materials covered in weeks 3-4 of semester, and formally builds upon  
EMG collected during week 3 laboratory session and additional analysis using single-unit, ECG, and  
EEG recordings.   
All students must submit individual reports. Regarding the EMG analysis, unless you have obtained  
permission from the course coordinator, all data you present must be your own physiological recordings.   
You will be assessed on a laboratory report that your write in response to these activities. In order to  
prepare your report, please refer also to the documents listed below:  
• Your report documenting these activities must be completed using the  
“elec7901_labreport_template_20200323.docx” document which details structure and formatting  
requirements.   
• The “elec7901_labreport_marksheet_20200323.pdf” document explains the marking criteria that  
will be applied to your report.   
These documents are available on blackboard from: “Assessment” > “Laboratory Report: Electrical  
Biosignals (20%)”.  
Reports will be submitted using Turnitin on Blackboard. This system checks for plagiarism. Importantly,  
you must answer all questions in your own words, and must not copy text from other students, the  
internet or text books. Please ensure you are familiar with ITEE and UQ’s academic integrity policy.  
These policies are actively enforced: https://www.itee.uq.edu.au/itee-student-misconduct-including- 
plagiarism   
This document outlines the tasks you are expected to complete. Minor amendments may be made to these  
tasks as necessary to clarify expectations of students.   
Part I: EMG  
1.1 Background  
The electromyogram (EMG) is an important method to analyse muscle activity. EMG from one muscle  
group is conventionally measured from a set of 3 electrodes. In addition to studies on muscular function  
and clinical applications, EMG may also be used to monitor sport activities, as a tool to interface with  
computers, and other applications.  
1.2 Primary aims  
1. Learn the required experimental procedure to obtain EMG signals  
2. Analyse EMG data using different signal processing tools in the following conditions: isometric  
vs. dynamic contractions, movement artefacts, different levels of isometric force, fatigue  
3. Identify and manage issues that may occur during EMG measurement  
1.3 Equipment and experimental protocol  
All EMG recordings will be conducted using the BioRadio devices, as configured according to the  
instructions provided for the Week 3 laboratory session, i.e. “BioRadio Lab Course –  
Electromyography I Laboratory”.  
1.4 Results and Questions  
Use MATLAB to analyse the acquired data according to the instructions below.   
Experimental results  
1. Depict the collected signals listed below. Discuss any particular problem occurred when  
measuring these signals. For instance, if you are also depicting data from another team member,  
explain what went wrong with your measurements.  
o “Isobiceps”, “Isowrist”, “Dynbiceps”, “Dynwrist”  
o Unfiltered and filtered data from steps 8 and 9  
o Weights  
o Fatigue  
Data analysis  
1. Using “weights.dat”, rectify the signal by taking the absolute value of it. For each weightlifting  
segment of the rectified signal (normally a total of three, but possibly only two), calculate the  
average and the RMS values of the rectified EMG signal. You should have three data points for  
each measure of overall EMG magnitude. Make two plots of Average and RMS Rectified EMG  
vs. “weight level”. Discuss which measure provided a better estimate of isometric force.  
2. Using MATLAB, create a band pass filter with cut-off frequencies of 15Hz and 50Hz. Rectify  
the signal from Channel 1 of the “Weights” data file and apply the filter you just made. Verify  
the filter is working correctly by looking at the resulting signal’s power spectrum. Apply the  
same procedure used in (1) to estimate the overall EMG magnitude. Are the results somewhat  
different from (1). Discuss. Tip: you may employ zero-lag filters using Matlab.  
3. Open each of the data files that you collected during isometric and dynamic muscle contractions  
including “Isobiceps”, “Isowrist”, “Dynbiceps”, and “Dynwrist”. For each of the data files  
examine the frequency components of each of the recordings using spectral analysis tools. Note  
and discuss any differences in the frequency components between dynamic and isometric  
motions of the arm. Also discuss potential sources of artefacts.  
4. Open the data file named “fatigue”. Using the tools for time-frequency analysis, plot the EMG  
frequency behaviour over time in that trial. You should be able to see a decrease in the frequency  
of the EMG signal over time due to fatigue. Discuss why this phenomenon happens.  
Part II: ECG  
1.1 Background  
The electrocardiogram (ECG) is an important clinical tool for both diagnosis and monitoring. The ECG  
is conventionally measured from a set of 4, 6 or 10 surface (Ag/AgCl) electrodes (to provide a 3, 5 or  
12 ‘lead’ ECG respectively). Typically, there are two aspects of the recorded ECG that are of clinical  
interest:  
• Time-voltage ECG waveform across the heart  
• Analysis of the time varying cardiac dipole vector, often called a vectorcardiogram (VCG).  
1.2 Primary aims  
1. Observe the vector nature of the ECG dipole and how this varies with posture  
2. Analyse electrocardiogram data using frequency series power spectral density (PSD) analysis  
methodology  
1.3 Experimental data  
All ECG recordings used in this part have been acquired using the BioRadio devices, according to  
instruction within the document “BioRadio Lab Course – Electrocardiography I Laboratory”. The data,  
which comprises three subjects, has been uploaded on Blackboard.  
The three-lead configuration comprised of four physical leads (left arm, left leg, right arm, right  
leg/ground) as specified in the "BioRadio Lab Course – Electrocardiography I Laboratory”.  
The experimental data collected contains the following lead configurations (Note: Right Leg (RL) is  
taken as ground):  
• Lead I: Left Arm (LA) non-inverting (+), Right Arm (RA) inverting (-)  
• Lead II: Left Leg (LL) non-inverting (+), Right Arm (RA) inverting (-)  
• Lead III: Left Leg (LL) non-inverting (+), Left Arm (LA) inverting (-)  
1.4 Results and Questions  
Use MATLAB to analyse the acquired data according to the instructions below.   
Data analysis  
1. Examine the ECG data of the following files (please pick one data file from each of the three  
categories below), and comment on the sources of artefacts shown in the examined data sets:  
a. ECG_Laying_StudentX OR ECG_Sitting_StudentX  
b. ECG_Clenching_StudentX  
c. ECG_Swinging_StudentX  
What other possible noise and artefacts would affect the ECG? How could the noise and artefacts  
be minimised? Show example annotated/labelled ECG traces of the artefact introduced in each  
case.  
2. ECG Bio-amplifier Signal Conditioning:  
a. Conduct a spectral analysis (frequency analysis) on the ECG waveform of  
ECG_Sitting_StudentX. Where do the peaks occur and why?  
b. Find the suitable band-pass filter cut-off frequencies (low-pass and high-pass) that best  
conditions the ECG. Show an example of your ECG data with and without a digital filter  
in both the time and frequency domain and explain the differences.  
3. Pick an ECG data set, compare leads I, II, III and explain the differences in the ECG waveform  
that you observe in each of the leads. You should highlight with an annotated figure showing an  
example part of your ECG trace.  
4. Einthoven’s Law stated that the sum of the potentials from all three channels should equal zero.  
Using this relationship, calculate what lead two should be, using only leads I and III data. Plot  
this calculated lead II, along with the measured lead II. Then, subtract the calculated lead II from  
the measured lead II and plot this error over time. Give a mean error between the calculated lead  
II and the actual lead II measurements. Does your data satisfy Einthoven’s Triangle? If not,  
explain the likely source(s) of error.  
Questions  
1. Explain the relationship between the P, Q, R, S and T potentials and the heart rhythm.  
2. Why isn’t atrial repolarisation seen in the ECG? Why is the amplitude of ventricular  
depolarization so much greater than the rest of the complexes in the ECG?  
Part III: EEG  
1.1 Background  
The electroencephalogram (EEG) is an important non-invasive tool for recording brain activity.  
Clinically, it may be used for diagnosing serious clinical conditions, as well as different disorders  
associated with the nervous system.   
1.2 Primary aims  
1. Understand the basic steps in processing spontaneous EEG signals  
2. Analyse EEG related to one of its clinical applications, notably investigating seizures  
1.3 Experimental data  
All EEG recordings used in this part are made available by Department of Epileptology at the University  
of Bonn. Check the link below or the corresponding paper for more information.  
http://epileptologie-bonn.de/cms/upload/workgroup/lehnertz/eegdata.html  
Andrzejak RG, Lehnertz K, Rieke C, Mormann F, David P, Elger CE (2001) Indications of nonlinear  
deterministic and finite dimensional structures in time series of brain electrical activity: Dependence on  
recording region and brain state, Phys. Rev. E, 64, 061907   
In the course Blackboard you will find part of the full dataset and support MATLAB scripts/functions.  
This will help developing your solution to the answers below. When evaluating your code, additional  
datasets (but from the same experiment) will be used.  
1.4 Results and Questions  
Use MATLAB to complete the tasks below. Some additional instructions:  
• Submit the MATLAB code for each requested function in the corresponding question.  
• Use the MATLAB template provided for each question. In particular, do not change the function  
header, since your function will be called by other scripts to be evaluated.  
• Also, avoid using high-level toolboxes or libraries. Develop your own code.  
Signal processing  
1. Develop [delta,theta,alpha,beta,gamma] = yourname_filtereeg(time,eegVoltage,signal), where  
time and eegVoltage are vectors that represent, respectively, time and voltage from a pair of EEG  
electrodes. The signal is pre-amplified. delta, theta, alpha, beta and gmama are vectors of same  
dimension that represent EEG characteristic frequency bands, i.e.  
a. Delta: 0.5 - 4 Hz  
b. Theta: 4-8Hz  
c. Alpha: 8-13Hz  
d. Beta: 13-20Hz  
e. Gamma: 20 - 40 Hz   
2. In this item, you should develop a MATLAB function to detect signals from epilepsy events  
(seizures). Provide classificationResult = yourname_seizuredetection (time, eegVoltage, signal),  
where time and eegVoltage are vectors that represent, respectively, the time and voltage from the  
pair of EEG electrodes and classificationResult must assume a value of 1 for a signal from an  
epilepsy event and 0 otherwise. Tip: use characteristics based on the frequency ranges calculated  
in item (b) to classify the signals.  
Part IV: Single-unit recordings  
1.1 Background  
Despite the advantages of signal that may be recorded using superficial electrodes, such as EMG, ECG,  
and EEG, in some applications recordings from single neurons are required. Being so close to neurons,  
in this modality one can identify action potentials individually, thus enabling different clinical  
applications to be developed.  
Thus, in general, the first processing stage in such systems is to identify the instants in which such  
firing occurred considering voltage signals with different noise levels. To solve this problem, note that  
assuming a fixed voltage threshold to detect the firing and disregarding a refractory period is not  
enough to provide satisfactory performance.  
In addition, in many cases an electrode is capable of detecting signals from different neurons. In such  
cases, algorithms are necessary to also classify spikes that compose the voltage signal from an  
electrode.  
1.2 Primary aims  
1. Develop methods for spike detection  
2. Develop methods for spike sorting  
1.3 Experimental data  
All single-unit recordings used in this part were obtained in actual experiments.  
In the course Blackboard you will find datasets and support MATLAB scripts/functions that will enable  
developing your solution to the answers below. When evaluating your code, additional datasets (but  
from the same experiment) will be used.  
1.4 Results and Questions  
Use MATLAB to complete the tasks below. Some additional instructions:  
• Submit the MATLAB code for each requested function in the corresponding question.  
• Use the MATLAB template provided for each question. In particular, do not change the function  
header, since your function will be called by other scripts to be evaluated.  
• Also, avoid using high-level toolboxes or libraries. Develop your own code.  
Signal processing  
1. Develop a function that determines the instants in which the firings occurred from  
electrophysiological records. The function must be of the form spikeTimes =  
yourname_spikedetection (time, electrodeVoltage, signal), where time and electrodeVoltage are  
vectors that represent, respectively, the time and the measurements taken. spikeTimes is a vector  
containing the time points in which the occurrence of a spike was detected. MATLAB's findPeaks  
function cannot be used.  
2. Develop a function [spikeTimesA, spikeTimesB] = yourname_spikesorting (time,  
electrodeVoltage, signal), where time and electrodeVoltage are vectors that represent,  
respectively, the time and the measurement performed. The spikeTimesA and spikeTimesB  
variables must represent vectors with NspikesA and NspikesB columns, where Nspikes  is the  
number of spikes detected. Each element of the vectors represents the instant in which the spike  
occurred. The following bibliography is suggested to assist in resolving the issue:  
a. Pascal Wallisch. Principal Component Analysis (cap. 14), in MATLAB for  
Neuroscientists. Elsevier, 2009  
b. Rodrigo Quian Quiroga, Spike Sorting, Scholarpedia, 2(12):3583, 2007