MATLAB for Neuroscientists: An Introduction to Scientific Computing in MATLAB (2nd Edition)
Pascal Wallisch, Michael E. Lusignan, Marc D. Benayoun, Tanya I. Baker, Adam Seth Dickey, Nicholas G. Hatsopoulos
Format: PDF / Kindle (mobi) / ePub
MATLAB for Neuroscientists serves as the only complete study manual and teaching resource for MATLAB, the globally accepted standard for scientific computing, in the neurosciences and psychology. This unique introduction can be used to learn the entire empirical and experimental process (including stimulus generation, experimental control, data collection, data analysis, modeling, and more), and the 2nd Edition continues to ensure that a wide variety of computational problems can be addressed in a single programming environment.
This updated edition features additional material on the creation of visual stimuli, advanced psychophysics, analysis of LFP data, choice probabilities, synchrony, and advanced spectral analysis. Users at a variety of levels-advanced undergraduates, beginning graduate students, and researchers looking to modernize their skills-will learn to design and implement their own analytical tools, and gain the fluency required to meet the computational needs of neuroscience practitioners.
precedes the event we measure, this term is a little awkward, so we will stick with the more general term — peri-event time histogram. Time histogram means you divide the time period into a series of bins (0 to 100 ms, 100 to 200 ms, etc.) and count how many spikes fall in each bin for all trials. Luckily, we just saw that MATLAB has a function that makes this easy: histc. To look at all trials, you will initialize the PETH with zeros and then sequentially add each trial’s results. Try the
works. Submit the main script and set of functions that give the option to generate spiral waves. Plot screenshots of the spiral wave generated at various timesteps t(i) by using the command: imagesc(reshape(v(i,1:N^2),N,N), clims); axis square for various values of i, as shown in Figure 30.5. Again, you can play with the various parameters to see how they affect the wave dynamics. Figure 30.4 Two-dimensional traveling wave produced by the Fitzhugh-Nagumo equations for t=0 (left), t=300
max_duration=max_duration/granularity; for bout=1:length(bouts) in_bout=find(seg_array(:,3)==bouts(bout)); dur=seg_array(in_bout,2) - seg_array(in_bout,1); dur=floor(dur/granularity); if max(dur)
[ndx, cmp]=rgb2ind(img,256); >> if ii == 1 >> imwrite(ndx,cmp,‘waveform’,‘gif’, ‘Loopcount’, inf, ‘DelayTime’, 0.1); >> else >> imwrite(ndx,cmp,‘waveform’,‘gif’, ‘WriteMode’, ‘append’, ‘DelayTime’, 0.1); >> end >> end There is a lot going on here. Let’s unpack it. First, we open a loop that goes through all 100 frames. Then, we extract the image data from the frames by using the function frame2im. Then, we convert the RGB image into an indexed image by using the rgb2ind function. Indexing
scope. As one might expect from the scope of global variables (i.e., available wherever global appears), all global variables share a workspace separate from command-line and function-level workspaces. 4.2.4 Script or Function? Script files and function files in MATLAB have distinct purposes, tightly related to both files’ respective use of scope. Because script files operate in the workspace used at the command line, script files act much like commands typed into the interactive prompt. This