我将数据存储在有关神经元记录的结构中。神经元尖峰存储在逻辑数组中,其中尖峰为 1,没有尖峰为 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 ...]
我要做的就是使用高斯滤波器将这些尖峰转换为平滑曲线信号。
我有以下平滑功能:
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
我只是想知道如何从类似于上述逻辑数组的尖峰中产生神经信号?
PS:我很迷茫,我的答案无法理解,无法发布在这里。
如果我理解正确的话,你只需要增加采样频率并进行卷积即可。由于您的原始阵列对应于采样频率为一个尖峰的信号,因此如果您想提高尖峰的分辨率,则需要人为地在尖峰之间引入更多数据点。
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];
![n_samples = numel(spike);
resampling_f = 50;
new_signal = zeros(n_samples*resampling_f,1);
spikes_ind = find(spike);
new_signal((spikes_ind-1)*50+round(resampling_f/2)) = 1;
%here you can use the spikes function you defined
winWidth = 10;
w = winWidth * 5;
t = -w : w;
kernel = normpdf(t,0,winWidth);
spikes_sample = conv(x,kernel);
figure, hold on
subplot(1,2,1), hold on
plot(new_signal)
subplot(1,2,2), hold on
plot(spikes_sample)][1]