Biomedical Engineering: Mathematical Methods for Bioengineers
VerifiedAdded on  2023/05/30
|14
|1456
|239
Homework Assignment
AI Summary
This assignment focuses on analyzing biomedical data using mathematical methods within the context of bioengineering. It involves loading and processing data related to mouse spatial trajectory and neuronal activity. The analysis includes plotting the mouse's spatial trajectory, determining its spatial phase, calculating the power spectrum of its speed, and analyzing fluorescence time series data from individual neurons. Cross-covariance analysis is performed on neuronal data, and principal component analysis is applied to reduce the dimensionality of multivariate time series data. The assignment uses MATLAB for data processing and visualization, providing insights into the relationship between mouse behavior and neuronal activity. Desklib offers this solution along with a wealth of study tools for students.

BIOMEDICAL ENGINEERING
COURSE CODE & ID
STUDENT NAME
STUDENT ID NUMBER
INSTRUCTOR (TUTOR)
DATE OF SUBMISSION
2018
COURSE CODE & ID
STUDENT NAME
STUDENT ID NUMBER
INSTRUCTOR (TUTOR)
DATE OF SUBMISSION
2018
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

MATHEMATICAL METHODS FOR BIOENGINEERS
INTRODUCTORY INFORMATION
The file contains a data structure mouse.fam1
struct with fields:
neuron: {140×1 cell}
spatialx: [22995×1 double]
spatialy: [22995×1 double]
spatialphi: [22995×1 double]
where the field neuron contains structures representing fluorescence data from each of 140
neurons, spatialx and spatialy indicate the position of the mouse at each timestep, and spatialphi
the angle in degrees of the mouse’s trajectory running around the loop. Assume that the spatial
position is sampled at 100 Hz. Each neuron contains a further structure
Struct with fields:
CaTimeSeriesGreen: [1×7420 double]
CaTimeSeriesRed: [1×7420 double]
deltaRoverR: [1×7420 double]
spikes: [1×7420 double]
of these we will for now make use only of deltaRoverR, which is sampled at 30 Hz. This signal
is the ratio of fluorescence in the green (GCaMP6s calcium-dependent fluorescence) and red
(mRuby structural marker) channel.
QUESTION 1
The data is loaded using the load function in Matlab. The structures are accessed from the loaded
section as shown below,
To obtain the mouse spatial trajectory in the x-y coordinate, we accessed the spatialx struct and
the spatialy struct.
1
INTRODUCTORY INFORMATION
The file contains a data structure mouse.fam1
struct with fields:
neuron: {140×1 cell}
spatialx: [22995×1 double]
spatialy: [22995×1 double]
spatialphi: [22995×1 double]
where the field neuron contains structures representing fluorescence data from each of 140
neurons, spatialx and spatialy indicate the position of the mouse at each timestep, and spatialphi
the angle in degrees of the mouse’s trajectory running around the loop. Assume that the spatial
position is sampled at 100 Hz. Each neuron contains a further structure
Struct with fields:
CaTimeSeriesGreen: [1×7420 double]
CaTimeSeriesRed: [1×7420 double]
deltaRoverR: [1×7420 double]
spikes: [1×7420 double]
of these we will for now make use only of deltaRoverR, which is sampled at 30 Hz. This signal
is the ratio of fluorescence in the green (GCaMP6s calcium-dependent fluorescence) and red
(mRuby structural marker) channel.
QUESTION 1
The data is loaded using the load function in Matlab. The structures are accessed from the loaded
section as shown below,
To obtain the mouse spatial trajectory in the x-y coordinate, we accessed the spatialx struct and
the spatialy struct.
1

The x-y coordinate plots were illustrated using the figure below,
To determine the spatial phase of the mouse’s position around the circular track, the spatialphi
data structure is accessed and the illustration is formed from the data obtained,
The velocity versus time is given as,
2
To determine the spatial phase of the mouse’s position around the circular track, the spatialphi
data structure is accessed and the illustration is formed from the data obtained,
The velocity versus time is given as,
2
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

QUESTION 2
To obtain the power spectrum of the speed of the mouse, the fft() function in MATLAB is used,
QUESTION 3
The question requires the fluorescence time series that corresponds to each individual neuron to
be loaded. The neuron structure is given as,
Each neuron contains a further structure
Struct with fields:
CaTimeSeriesGreen: [1×7420 double]
CaTimeSeriesRed: [1×7420 double]
deltaRoverR: [1×7420 double]
spikes: [1×7420 double]
The power spectrum is compared to that obtained in question 2,
To access the neurons one must mention the struct as a vector or dictionary element using the
neurons{1,1}. Actual structure.
3
To obtain the power spectrum of the speed of the mouse, the fft() function in MATLAB is used,
QUESTION 3
The question requires the fluorescence time series that corresponds to each individual neuron to
be loaded. The neuron structure is given as,
Each neuron contains a further structure
Struct with fields:
CaTimeSeriesGreen: [1×7420 double]
CaTimeSeriesRed: [1×7420 double]
deltaRoverR: [1×7420 double]
spikes: [1×7420 double]
The power spectrum is compared to that obtained in question 2,
To access the neurons one must mention the struct as a vector or dictionary element using the
neurons{1,1}. Actual structure.
3
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

The speed of the mouse power spectrum shows a more compact approach in the neuron output as
compared to the motion power spectrum.
QUESTION 4
To obtain the cross-covariance of two structs in the neuron parameter of the mouse data, the two
values are loaded and placed in a single matrix. The first section requires a linear detrend of the
data. Later the cross-covariance is performed.
It is possible to observe that when the matrix is generated and a zero-lag cross-covariance is
performed between the time series of the neuron at structure 1 and that at structure 10, the output
is almost uniform for the outer columns of the matrix. The two columns differ from those in the
middle as shown in the subplots of figure 6.
4
compared to the motion power spectrum.
QUESTION 4
To obtain the cross-covariance of two structs in the neuron parameter of the mouse data, the two
values are loaded and placed in a single matrix. The first section requires a linear detrend of the
data. Later the cross-covariance is performed.
It is possible to observe that when the matrix is generated and a zero-lag cross-covariance is
performed between the time series of the neuron at structure 1 and that at structure 10, the output
is almost uniform for the outer columns of the matrix. The two columns differ from those in the
middle as shown in the subplots of figure 6.
4

QUESTION 5
Further, to obtain the principal component analysis of the raw data, the population vector is used.
In this case the population vector has most of the structures in the neuron data file. The eigen
values are obtained using the eig() function. Further, the trajectory is plotted in both 2D plot as
well as a surf plot to illustrate the 3D illustration.
APPENDIX
%BE9-MMMB-Mathematical Methods for Bioengineers
%Take Home Test One
clear all
close all
clc
%Load data: Record of a mouse running around in a circular track
Mouse=load('Mouse.mat');
fs=100; %Sample spatial position 100Hz
pt1=Mouse.mouse.fam1();
Question 1
% Part A- Mouse Spatial Trajectory in x-y coordinates
mx=Mouse.mouse.fam1.spatialx();
my=Mouse.mouse.fam1.spatialy();
figure(1)
ta=1:length(mx);
tb=1:length(my);
subplot(2,1,1)
plot(ta,mx,'r-.');
grid on
title('Mouse Spatial Trajectory in X ')
subplot(2,1,2)
plot(tb,my,'b-.');
grid on
5
Further, to obtain the principal component analysis of the raw data, the population vector is used.
In this case the population vector has most of the structures in the neuron data file. The eigen
values are obtained using the eig() function. Further, the trajectory is plotted in both 2D plot as
well as a surf plot to illustrate the 3D illustration.
APPENDIX
%BE9-MMMB-Mathematical Methods for Bioengineers
%Take Home Test One
clear all
close all
clc
%Load data: Record of a mouse running around in a circular track
Mouse=load('Mouse.mat');
fs=100; %Sample spatial position 100Hz
pt1=Mouse.mouse.fam1();
Question 1
% Part A- Mouse Spatial Trajectory in x-y coordinates
mx=Mouse.mouse.fam1.spatialx();
my=Mouse.mouse.fam1.spatialy();
figure(1)
ta=1:length(mx);
tb=1:length(my);
subplot(2,1,1)
plot(ta,mx,'r-.');
grid on
title('Mouse Spatial Trajectory in X ')
subplot(2,1,2)
plot(tb,my,'b-.');
grid on
5
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

title('Mouse Spatial Trajectory in Y ')
% Part B- The spatial phase of the mouse's position around the circular track
mph=Mouse.mouse.fam1.spatialphi();
figure(2)
t1=length(mph);
plot(mx,my,'b-.')
grid on
title('Spatial Phase of the Mouse Position around the Circular Track')
%To determine the vector plot
mxx=diff(mx);
myy=diff(my);
figure(3)
t2=1:length(mxx);
plot(t2,mxx,'b-.')
grid on
title('Velocity versus time')
6
% Part B- The spatial phase of the mouse's position around the circular track
mph=Mouse.mouse.fam1.spatialphi();
figure(2)
t1=length(mph);
plot(mx,my,'b-.')
grid on
title('Spatial Phase of the Mouse Position around the Circular Track')
%To determine the vector plot
mxx=diff(mx);
myy=diff(my);
figure(3)
t2=1:length(mxx);
plot(t2,mxx,'b-.')
grid on
title('Velocity versus time')
6
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

7

Question 2
...Plotting the power spectrum for the speed of the mouse
h=fft(abs(mxx),abs(myy)); %power spectrum Mouse speed
figure(4)
plot(h,'b-.')
grid on
title('Power Spectrum for the speed of the Mouse')
Question 3
... Load the fluorescence time series corresponding to each individual neuron
%To view the neuron structure
neuronSt=pt1.neuron();
pnrn1=neuronSt{1,1}.CaTimeSeriesGreen();
pnrn2=neuronSt{10,1}.CaTimeSeriesGreen();
pnrn3=neuronSt{2,1}.CaTimeSeriesGreen();
pnrn4=neuronSt{3,1}.CaTimeSeriesGreen();
pnrn5=neuronSt{4,1}.CaTimeSeriesGreen();
pnrn6=neuronSt{5,1}.CaTimeSeriesGreen();
pnrn7=neuronSt{6,1}.CaTimeSeriesGreen();
pnrn8=neuronSt{7,1}.CaTimeSeriesGreen();
8
...Plotting the power spectrum for the speed of the mouse
h=fft(abs(mxx),abs(myy)); %power spectrum Mouse speed
figure(4)
plot(h,'b-.')
grid on
title('Power Spectrum for the speed of the Mouse')
Question 3
... Load the fluorescence time series corresponding to each individual neuron
%To view the neuron structure
neuronSt=pt1.neuron();
pnrn1=neuronSt{1,1}.CaTimeSeriesGreen();
pnrn2=neuronSt{10,1}.CaTimeSeriesGreen();
pnrn3=neuronSt{2,1}.CaTimeSeriesGreen();
pnrn4=neuronSt{3,1}.CaTimeSeriesGreen();
pnrn5=neuronSt{4,1}.CaTimeSeriesGreen();
pnrn6=neuronSt{5,1}.CaTimeSeriesGreen();
pnrn7=neuronSt{6,1}.CaTimeSeriesGreen();
pnrn8=neuronSt{7,1}.CaTimeSeriesGreen();
8
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

pnrn9=neuronSt{8,1}.CaTimeSeriesGreen();
pnrn10=neuronSt{9,1}.CaTimeSeriesGreen();
h1=fft(pnrn1);
%plotting the power spectrum
figure(5)
plot(h1,'r-.')
grid on
title('Power Spectrum of Calcium time series, averaged over cells')
Question 4
...creating matrix c(ij)
pnrn=[pnrn1' pnrn2'];
Y=detrend(pnrn,'linear');
B=xcov(Y); %performs the cross covariance
B1=B(:,1);
B2=B(:,2);
B3=B(:,3);
B4=B(:,4);
9
pnrn10=neuronSt{9,1}.CaTimeSeriesGreen();
h1=fft(pnrn1);
%plotting the power spectrum
figure(5)
plot(h1,'r-.')
grid on
title('Power Spectrum of Calcium time series, averaged over cells')
Question 4
...creating matrix c(ij)
pnrn=[pnrn1' pnrn2'];
Y=detrend(pnrn,'linear');
B=xcov(Y); %performs the cross covariance
B1=B(:,1);
B2=B(:,2);
B3=B(:,3);
B4=B(:,4);
9
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

figure(6)
subplot(4,1,1)
plot(B1,'r-.')
grid on
subplot(4,1,2)
plot(B2,'b-.')
grid on
subplot(4,1,3)
plot(B3,'g-.')
grid on
subplot(4,1,4)
plot(B4,'cyan-.')
grid on
DISCUSSION
10
subplot(4,1,1)
plot(B1,'r-.')
grid on
subplot(4,1,2)
plot(B2,'b-.')
grid on
subplot(4,1,3)
plot(B3,'g-.')
grid on
subplot(4,1,4)
plot(B4,'cyan-.')
grid on
DISCUSSION
10

It is possible to observe that when the matrix is generated and a zero-lag cross-covariance is
performed between the time series of the neuron at structure 1 and that at structure 10, the output is
almost uniform for the outer columns of the matrix. The two columns differ from those in the middle as
shown in the subplots of figure 6.
Question 5
%part a
... Using the Principal Component Analysis
... Dimensionality reduction of the multivariate time series
%population vector
C=[pnrn1' pnrn2' pnrn3' pnrn4' pnrn5' pnrn6' pnrn7' pnrn8' pnrn9' pnrn10'];
figure(7)
t5=1:length(B);
plot(t5,B1,'r-.',t5,B2,'g-.',t5,B3,'b-.',t5,B4,'magenta-.')
grid on
coeff=pca(B) % determining the principal component analysis of raw data
%plotting the eigenvalues
R=eig(coeff) %To obtain the eigenvalues
%Plotting the Trajectory
k=1:length(C);
plot(k,C)
grid on
title('Population Vector- 2D')
xlabel('Time series')
ylabel('Population Vector')
figure(8)
surf(C)
grid on
coeff =
0.0614 0.0135 0 0.9980
-0.0012 0.7070 -0.7071 -0.0095
-0.0012 0.7070 0.7071 -0.0095
11
performed between the time series of the neuron at structure 1 and that at structure 10, the output is
almost uniform for the outer columns of the matrix. The two columns differ from those in the middle as
shown in the subplots of figure 6.
Question 5
%part a
... Using the Principal Component Analysis
... Dimensionality reduction of the multivariate time series
%population vector
C=[pnrn1' pnrn2' pnrn3' pnrn4' pnrn5' pnrn6' pnrn7' pnrn8' pnrn9' pnrn10'];
figure(7)
t5=1:length(B);
plot(t5,B1,'r-.',t5,B2,'g-.',t5,B3,'b-.',t5,B4,'magenta-.')
grid on
coeff=pca(B) % determining the principal component analysis of raw data
%plotting the eigenvalues
R=eig(coeff) %To obtain the eigenvalues
%Plotting the Trajectory
k=1:length(C);
plot(k,C)
grid on
title('Population Vector- 2D')
xlabel('Time series')
ylabel('Population Vector')
figure(8)
surf(C)
grid on
coeff =
0.0614 0.0135 0 0.9980
-0.0012 0.7070 -0.7071 -0.0095
-0.0012 0.7070 0.7071 -0.0095
11
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide
1 out of 14
Your All-in-One AI-Powered Toolkit for Academic Success.
 +13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
Copyright © 2020–2025 A2Z Services. All Rights Reserved. Developed and managed by ZUCOL.