I have my data stored in structures regarding recording from neurons. Neuronal spikes are stored in a logical array where a spike is 1 and no spike is 0.
spike = <1x50 logical>
spike = [1 0 0 0 1 0 0 1 0 0 0 0 0 0 1 1 1 0 1 0 1 0 0 0 1 1 0 0 ...]
What I have to do is to convert these spikes into smooth curve signal using Gaussian filter.
I have the following function for smoothing:
function z = spikes(x, winWidth)
% places a Gaussian centered on every spike
% if x is matrix, then perform on the columns
winWidth = round(winWidth);
if winWidth == 0
y = [0 1 0];
w = 1;
else
w = winWidth * 5;
t = -w : w;
y = normpdf(t,0,winWidth);
end
if isvector(x)
z = conv(x,y);
z = z(w+1 : end);
z = z(1 : length(x));
else
z = zeros(size(x));
for i = 1 : size(x,2)
z1 = conv(x(:,i),y);
z1 = z1(w+1 : end);
z1 = z1(1 : length(x));
z(:,i) = z1;
end
end
end
I was just wondering how can I make nerve signals from spikes that are like the above logical array?
PS: I am very lost and my answers are not understandable to be posted here.
If I understood correctly you just have to increase the sampling frequency and convolve. Since your original array corresponds to a signal with sampling frequency of one spike, if you want to increase the resolution of your spikes, you need to artificially introduce more data points between the spikes.