フィルターのクリア

Help with assigning values to a matrix (coursera course)

6 ビュー (過去 30 日間)
Jane
Jane 2015 年 5 月 21 日
Hello all, this is from a coursera course on computational neuroscience. What I'm trying to do is gather all the indices for spikes (spike_times = indices of where 1 appears in the vector named rho) and use those indices in the vector stim to get the stimulus value. There are ~53,000 spikes so there will be ~53,000 vectors of these stimulus values and the length of each of these vectors should be 150 (called num_timesteps in this code). to fill in sta, these vectors will summed together and divided by the num_spikes to get the average. I would like to figure this out for the most part on my own so that I can learn, but I'm a beginner at matlab. Could someone just give me a few pointers on how this will be structured in code? You can see the few lines I've started so far under "your code goes here". Thank you.
if true
function [ sta ] = compute_sta( stim, rho, num_timesteps )
%COMPUTE_STA Calculates the spike-triggered average for a neuron that
% is driven by a stimulus defined in stim. The spike-
% triggered average is computed over num_timesteps timesteps.
sta = zeros(num_timesteps, 1);
% This command finds the indices of all of the spikes that occur
% after 300 ms into the recording.
spike_times = find(rho(num_timesteps+1:end)) + num_timesteps;
% Fill in this value. Note that you should not count spikes that occur
% before 300 ms into the recording.
num_spikes = sum(rho(151:size(rho)) == 1);
% Compute the spike-triggered average of the spikes found using the
% find command. To do this, compute the average of all of the vectors
% starting 300 ms (exclusive) before a spike and ending at the time of
% the event (inclusive). Each of these vectors defines a list of
% samples that is contained within a window of 300 ms before the each
% spike. The average of these vectors should be completed in an
% element-wise manner.
%
% Your code goes here.
for idx = 1:numel(spike_times)
stimulus = stim(idx)
end end
  1 件のコメント
Myriam Escobar-Khondiker
Myriam Escobar-Khondiker 2022 年 1 月 6 日
Hi,
I'm n the same boat as you... new to matlab and trying to wrap my head around this question...
Can anybody help out please??

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeElectrophysiology についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by