M3 4 Assignment
M3 4 Assignment
Neural Prosthetics
You have two weeks to complete this assignment; it is due at the end of Module 4. Please start
it early!
Deliverables/scoring:
Please submit a zip file containing your images, code, and a PDF of your responses.
Part 1 – Frequency-based noise removal (2 points)
Goal: Remove noise from the neural spike data using frequency-based filters.
Procedure:
1. From Canvas, download the MATLAB files found under Assignments > Module 3/4
Assignment. Open the Assignment_Module3.m file in MATLAB. Load the neural spike
data found in the file spikes.mat. Please do not rename existing variables or modify the
existing lines of code.
2. Bandpass filter the imported neural spike data by filling in the missing parameters in
Section 1. The following variables need to be defined by you:
a. fs – the sampling frequency of the neural spike data
b. fl – the desired lower bound cutoff frequency of the bandpass filter
c. fh – the desired higher bound cutoff frequency of the bandpass filter
3. Once each variable is defined, run the code in Section 1 to bandpass filter the neural
spike data and generate a plot of the pre- and post-filtered spectral content of the
recorded data. Save this plot as: spikes_bpf.png
Goal: Implement the nonlinear energy operator and apply it to the neural spike data.
Procedure:
1. Create a MATLAB function file neo.m in which you will implement the nonlinear energy
operator (NEO) described in lecture. Hint: pay close attention to the square brackets,
and how the first and last samples may handled differently. The desired function
template is as follows:
2. Once you have implemented neo.m, apply the transform to the filtered neural spike data
and generate a plot of the NEO signal by running the code in Section 2.
Save this plot as: neo.png.
Goal: Implement a spike detection and alignment algorithm using the NEO transformation.
Procedure:
2. Once the threshold has been determined, open the align_spikes.m function in
MATLAB. This code will implement your spike detection and alignment algorithm. Your
algorithm must comply with the following processing logic:
a. Neural spikes must be detected when the NEO signal is greater than the
threshold defined by eps.
b. The neural waveform is defined as 300 microseconds before and 600
microseconds after the peak of the absolute value of the detected neural spike.
c. The recorded index of the neural spike is defined as the index in fdata where the
peak of the absolute value of the neural waveform occurs.
4. Run the code in Section 3 to detect spikes in the filtered neural data and generate a plot
of the detected waveforms. Save this plot as: spikes_aligned.png.
Goal: Use clustering of the neural waveforms to determine the number of recorded neurons.
Procedure:
1. Using the code in Section 4 of Assignment_Module3.m, perform principal component
analysis (PCA) and k-mean clustering on the detected neural waveforms to determine
how many neurons are being recorded by this single channel. The following variable
needs to be defined by you:
a. k – the expected number of neurons to find in the clustering
Determining the value of k is largely a subjective process. We suggest plotting the PCA-
transformed neural waveforms and using your best judgment to determine how many
clusters you believe you observe.
2. Once k is determined, run the code in Section 4 to a plot of the k-means clustered
neural waveforms. Save this plot as: spikes_clusters.png.