This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
analysis:course:week10 [2014/07/22 11:02] mvdm [Estimating tuning curves] |
analysis:course:week10 [2018/07/07 10:19] (current) |
||
---|---|---|---|
Line 137: | Line 137: | ||
<code matlab> | <code matlab> | ||
- | occ_binned = ndhist(cat(1,getd(pos,'x'),getd(pos,'y')),[SET_nxBins; SET_nyBins],[SET_xmin; SET_ymin],[SET_xmax; SET_ymax]); | + | occ_binned = ndhist(cat(1,Data(sd.x)',Data(sd.y)'),[SET_nxBins; SET_nyBins],[SET_xmin; SET_ymin],[SET_xmax; SET_ymax]); |
- | + | ||
% this is a sample count, so need to convert to seconds (1/30s per sample) to get time | % this is a sample count, so need to convert to seconds (1/30s per sample) to get time | ||
VT_Fs = 30; | VT_Fs = 30; | ||
tc = spk_binned./(occ_binned .* (1./VT_Fs)); % firing rate is spike count divided by time | tc = spk_binned./(occ_binned .* (1./VT_Fs)); % firing rate is spike count divided by time | ||
- | + | ||
pcolor(tc'); shading flat; | pcolor(tc'); shading flat; | ||
axis xy; colorbar; axis off; | axis xy; colorbar; axis off; | ||
Line 167: | Line 167: | ||
% occupancy | % occupancy | ||
- | occ_binned = ndhist(cat(1,getd(pos,'x'),getd(pos,'y')),[SET_nxBins; SET_nyBins],[SET_xmin; SET_ymin],[SET_xmax; SET_ymax]); | + | occ_binned = ndhist(cat(1,Data(sd.x)',Data(sd.y)'),[SET_nxBins; SET_nyBins],[SET_xmin; SET_ymin],[SET_xmax; SET_ymax]); |
occ_binned = conv2(occ_binned,kernel,'same'); | occ_binned = conv2(occ_binned,kernel,'same'); | ||