MATLAB for neuroscientists an introduction to scientific computing in MATLAB 1st Edition Pascal Wallisch - The ebook is ready for download with just one simple click
MATLAB for neuroscientists an introduction to scientific computing in MATLAB 1st Edition Pascal Wallisch - The ebook is ready for download with just one simple click
com
https://ebookname.com/product/matlab-for-neuroscientists-an-
introduction-to-scientific-computing-in-matlab-1st-edition-
pascal-wallisch/
OR CLICK HERE
DOWLOAD EBOOK
https://ebookname.com/product/an-introduction-to-partial-
differential-equations-with-matlab-second-edition-coleman/
https://ebookname.com/product/matlab-an-introduction-with-
applications-1st-edition-amos-gilat/
https://ebookname.com/product/introduction-to-matlab-for-
engineers-3rd-edition-william-j-palm/
https://ebookname.com/product/nationalisms-in-japan-1st-edition-
naoko-shimazu/
Balkans into Southeastern Europe 1914 2014 A Century of
War and Transition 2nd Edition Lampe
https://ebookname.com/product/balkans-into-southeastern-
europe-1914-2014-a-century-of-war-and-transition-2nd-edition-
lampe/
https://ebookname.com/product/peterson-s-ap-english-literature-
composition-master-the-ap-english-literature-composition-
test-1st-edition-petersons/
https://ebookname.com/product/girls-and-
education-3-16-continuing-concerns-new-agendas-1st-edition-
carolyn-jackson/
https://ebookname.com/product/the-art-of-lego-mindstorms-nxt-g-
programming-1st-edition-terry-griffin/
https://ebookname.com/product/rules-for-the-transfer-of-movables-
wolfgang-faber/
Calorimetry First Edition Feig
https://ebookname.com/product/calorimetry-first-edition-feig/
Academic Press. is an imprint of Elsevier
MATLABW is a trademark of The MathWorks, Inc. and is used with permission. The
MathWorks does not warrant the accuracy of the text or exercises in this book. This book’s
use or discussion of MATLABW software or related products does not constitute endorsement
or sponsorship by The MathWorks of a particular pedagogical approach or particular use of
the MATLABW software.
Permissions may be sought directly from Elsevier’s Science & Technology Rights
Department in Oxford, UK: phone (þ44) 1865 843830, fax: (þ44) 1865 853333,
E-mail: [email protected]. You may also complete your request online
via the Elsevier homepage (http://elsevier.com/), by selecting “Support & Contact” then “Copyright
and Permission” and then “Obtaining Permissions.”
IBSN: 978-0-12-374551-4
Printed in China
08 09 10 9 8 7 6 5 4 3 2 1
Preface
The creation of this book stems from a set specialized—software for stimulus genera-
of courses offered over the past several years tion, data collection, data analysis, and data
in quantitative neuroscience, particularly modeling, respectively. Although this alter-
within the graduate program in compu- native is a feasible strategy, it does intro-
tational neuroscience at the University of duce a number of problems: namely, the
Chicago. This program started in 2001 and need to convert data between different plat-
is one of the few programs focused on forms and formats and to keep up with a
computational neuroscience with a com- wide range of software packages as well
plete curriculum including courses in as the need to learn ever-new specialized
cellular, systems, behavioral, and cognitive home-cooked “local” software when enter-
neuroscience; neuronal modeling; and ing a new lab. As we have realized in our
mathematical foundations in computational own professional life as scientists, these
neuroscience. Many of these courses in- obstacles can be far from trivial and a
clude not only lectures but also lab sessions significant detriment to productivity.
in which students get hands-on experience We also believe that our comprehensive
using the MATLABW software to solve MATLAB “strategy” makes particular sense
various neuroscientific problems. for educational purposes, as it empowers
The content of our book is oriented along users to progressively solve a wide variety
the philosophy of using MATLAB as a com- of computational problems and challenges
prehensive platform that spans the entire within a single programming environment.
cycle of experimental neuroscience: stimu- It has the added advantage of an elegant
lus generation, data collection and experi- progression within the problem space. Our
mental control, data analysis, and finally experience in teaching has led us to this
data modeling. We realize that this approach that does not focus on the inher-
approach is not universally followed. Quite ent structure of MATLAB as a computer
a number of labs use different—and programming language but rather as a tool
vii
viii PREFACE
Pascal Wallisch, PhD, Center for Neural Tanya I. Baker, PhD, Junior Research Fel-
Science, New York University low, Crick-Jacobs Center for Theoretical
Pascal received his PhD from the University Neurobiology, The Salk Institute for
of Chicago and is now a postdoctoral fellow Biological Studies, La Jolla, California
at New York University. He is currently Tanya is a junior research fellow modelling
studying the processing of visual motion. large-scale neuronal population dynamics
Pascal is passionate about teaching, as well using modern statistical methods. Previ-
as the communication of scientific concepts ously, she was a post-doctoral lecturer at
to a wider audience. He was recognized for the University of Chicago where she devel-
his distinguished teaching record by the oped and taught Mathematical Methods for
University of Chicago Booth Prize. the Biological Sciences, a new year-long
course with a computer lab component.
Michael Lusignan, Committee on Compu- She received her PhD in Physics at the Uni-
tational Neuroscience, University of versity of Chicago and her BS in Physics
Chicago and Applied Mathematics at UCLA.
Michael is an advanced graduate student
who has enjoyed teaching several courses Adam Dickey, Committee on Computa-
involving MATLAB to graduate, as well as tional Neuroscience, University of Chicago
undergraduate students. He infuses his teach- Adam is an MD/PhD candidate at the Uni-
ing with eight years of experience in active versity of Chicago. He is currently a gradu-
software development. His current interests ate student in the laboratory of Dr. Nicholas
include sensory encoding in neuroethological Hatsopoulos. Adam is interested in improv-
model systems. ing decoding techniques used for neural
prosthetic control.
Marc Benayoun, Committee on Computa-
tional Neuroscience, University of Chicago Nicholas G. Hatsopoulos, PhD, Depart-
Marc is an MD/PhD student currently ment of Organismal Biology and Anatomy
interested in applying statistical field the- & Department of Neurology, University of
ory to study neural networks with applica- Chicago
tions to epilepsy. He has an extensive Nicholas is Associate Professor and Chair-
teaching record and was also awarded the man of the graduate program on Computa-
University of Chicago Booth Prize. tional Neuroscience. He teaches a course in
xi
xii ABOUT THE AUTHORS
Cognitive Neuroscience which formed the of the arm and hand. He is also developing
basis for some of the chapters in the book. brain-machine interfaces by which patients
His research focuses on how ensembles of with severe motor disabilities could activate
cortical neurons work together to control, large groups of neurons to control external
coordinate, and learn complex movements devices.
How to Use This Book
A text of a technical nature tends to be specific, while the suggestions for exploration
more readily understood if its design princi- tend to be of a rather sweeping nature. This
ples are clear from the very outset. This is process of successive introduction and rein-
also the case with this book. Hence, we will forcement of functions and concepts culmi-
use this space to briefly discuss what we nates in a “project”, a large programming
had in mind when writing the chapters. task that ties all the material covered in the
Hopefully, this will improve usability and book together. This will allow you to put
allows you to get most out of the book. the learned materials to immediate use in a
larger goal, often utilizing “real” experimen-
tal data. Finally, we list the MATLAB func-
tions introduced in the chapter at the very
STRUCTURAL AND end. It almost goes without saying that
CONCEPTUAL you will get the most out of this book if you
CONSIDERATIONS have a version of MATLAB open and run-
ning while going through the chapters. That
A chapter typically begins with a concise way, you can just try out the functions we
overview of what material will be covered. introduce, try out new code, etc.
Moreover, we usually put the chapter in the Hence, we implicitly assumed this to be
broader context of practical applications. the case when writing the book.
This brief introduction is followed by a dis- Moreover, we made sure that all the code
cussion of the conceptual and theoretical works when running the latest version of
background of the topic in question. The MATLAB (currently 7.7). Don’t let this con-
heart of each chapter is a larger section in cern you too much, though. The vast major-
which we introduce relevant MATLABW ity of code should work if you use anything
functions that allow you to implement meth- above version 6.0. We did highlight some
ods or solve problems that tend to come up important changes where appropriate.
in the context of the chapter topic. This part
of the chapter is enriched by small exercises
and suggestions for exploration. We believe LAYOUT AND STYLE
that doing the exercises is imperative to
attain a sufficiently deep understanding of The reader can utilize not only the concep-
the function in question, while the sugges- tual structure of each chapter as outlined
tions for exploration are aimed at readers above, but also profit from the fact that we sys-
who are particularly interested in broadening tematically encoded information about the
their understanding of a given function. In function of different text parts in the layout
this spirit, the exercises are usually rather and style of the book.
xiii
xiv HOW TO USE THIS BOOK
1
Introduction
Neuroscience is at a critical juncture. In the past few decades, the essentially biological
nature of the field has been infused by the tools provided by mathematics. At first, the
use of mathematics was mostly methodological in nature—primarily aiding the analysis
of data. Soon, this influence turned conceptual, framing the very issues that characterize
modern neuroscience today. Naturally, this development has not remained uncontroversial.
Some neurobiologists of yore resent what they perceive to be a hostile takeover of the field,
as many quantitative methods applied to neurobiology were pioneered by nonbiologists
with a background in physics, engineering, mathematics, statistics, and computer science.
Their concerns are not entirely without merit. For example, Hubel and Wiesel (2004) warn
of the faddish nature that the idol of “computation” has taken on, even likening it to a dan-
gerous disease that has befallen the field and that we should overcome quickly in order to
restore its health.
While these concerns are valid to some degree and while excesses do happen, we
strongly believe that—all in all—the effect of mathematics in the neurosciences has been
very positive. Moreover, we believe that our science is and will continue to be one that is
computational at its very core. Historically, this notion stems in part from the influence that
cognitive psychology has had in the study of the mind. Cognitive psychology and cognitive
science, more generally, posited that the mind and, by extension, the brain should be
viewed as an information processing device that receives inputs and transforms these
inputs into intermediate representations which ultimately generate observable outputs. At
the same time that cognitive science was taking hold in psychology in the 1950s and
1960s, computer science was developing beyond mere number crunching and considering
the possibility that intelligence could be modeled computationally, leading to the birth of
artificial intelligence. The information processing perspective, in turn, ultimately influenced
the study of the brain and is best exemplified by an influential book by David Marr titled
Vision, published in 1982. In that book, Marr proposed that vision and, more generally,
the brain should be studied at three levels of analysis: the computational, algorithmic,
and implementational levels. The challenge at the computational level is to determine what
computational problem a neuron, neural circuit, or part of the brain is solving. The
3
4 1. INTRODUCTION
algorithmic level identifies the inputs, the outputs, their representational format, and the
algorithm that takes the input representation and transforms it into an output representa-
tion. Finally, the implementational level identifies the neural “hardware” and biophysical
mechanisms that underlie the algorithm which solves the problem. Today, this perspective
has permeated not only cognitive neuroscience but also systems, cellular, and even molec-
ular neuroscience.
Importantly, such a conceptualization of our field places chief importance on the issues
surrounding scientific computing. For someone to participate in or even appreciate state
of the art debates in modern neuroscience, that person has to be well versed in the language
of computation. Of course, it is the task of education—if it is to be truly liberal—to enable
students to do so. Yet, this poses a quite formidable challenge.
For most students interested in neuroscience, mathematics amounts to what is essentially
a foreign language. Similarly, the language of scientific computing is typically as foreign to
students as it is powerful. The prospects of learning both at the same time can be daunting
and—at times—overwhelming. So what is a student or educator to do?
Immersion has been shown to be a powerful way to learn foreign languages (Genesee,
1985). Hence, it is imperative that students are using these languages as often as possible
when facing a problem in the field. For immersion to work, the learning experience has
to be positive, yielding useful results that solve some real or perceived problem. Unfortu-
nately, the inherent complexity as well as the seemingly arcane formalisms that characterize
both are usually very off-putting to students, requiring much effort with little tangible
yield, reducing the likelihood of further voluntary immersion.
To break this catch-22, the utility of learning these languages has to be drastically
increased while making the learning process more accessible and manageable at the same
time, even during the learning process itself. As we alluded to previously, this is a tall
order. Fortunately, there is a way out of this conundrum. Recent advances in software, as
well as hardware, have instantiated scientific computing within the framework of a unified
computational environment. One of these environments is provided by the MATLABW
software. For reasons that will become readily apparent in this book, MATLAB fulfills the
requirements that are necessary to meet and overcome the challenges outlined earlier.
In addition—and partly for these reasons—MATLAB has become the de facto standard of
scientific computing in our field. More strongly, MATLAB really has become the lingua
franca that all serious students of neuroscience are expected to understand in the very near
future, if not already today.
This, in turn, introduces a new—albeit more tractable—problem. How does one teach
MATLAB to a useful level of proficiency without making the study of MATLAB itself an
additional problem and simply another chore for students? Overcoming this problem as a
key to reaching the deeper goals of fluency in mathematics and scientific computing is
a crucial goal of this book. We reason that a gentle introduction to MATLAB with a special
emphasis on immediate results will computationally empower you to such a degree that the
practice of MATLAB becomes self-sustaining by the end of the book. We carefully picked
the content such that the result constitutes a confluence of ease (gradually increasing
sophistication and complexity) and relevance. We are confident that at the end of the book
you will be at a level where you will be able to venture out on your own, convinced of the
utility of MATLAB as a tool as well as your abilities to harness this power henceforth. We
1. INTRODUCTION 5
have tested the various parts of the contents of this book on our students and believe that
our approach has been successful. It is our sincere wish and hope that the material
contained will be as beneficial to you as it was to those students.
With this in mind, we would like to outline two additional specific goals of this book.
First, the material covered in the chapters to follow gives a MATLAB perspective on many
topics within computational neuroscience across multiple levels of neuroscientific inquiry
from decision-making and attentional mechanisms to retinal circuits and ion channels. It
is well known that an active engagement with new material facilitates both understanding
and long-time retention of said material. The secondary aim of this book is to acquire pro-
ficiency in programming using MATLAB while going through the chapters. If you are
already proficient in MATLAB, you can go right to the chapters following the tutorial.
For the rest, the tutorial chapter will provide a gentle introduction to the empowering qua-
lities that the mastery of a language of scientific computing affords.
We take a project-based approach in each chapter so that you will be encouraged to write
a MATLAB program that implements the ideas introduced in the chapter. Each chapter
begins with background information related to a particular neuroscientific or psychological
problem, followed by an introduction to the MATLAB concepts necessary to address that
problem with sample code and output included in the text. You are invited to modify,
expand, and improvise on these examples in a set of exercises. Finally, the project assign-
ment introduced at the end of the chapter requires integrating the exercises. Most of the
projects will involve genuine experimental data that are either collected as part of the project
or were collected through experiments in research labs. In some rare cases, we use published
data from classical papers to illustrate important concepts, giving you a computational
understanding of critically important research.
In addition, solutions to exercises as well as executable code can be found in the online
repository accompanying this book.
Finally, we would like to point out that we are well aware that there is more than one
way to teach—and learn—MATLAB in a reasonably successful and efficient manner. This
book represents a manifestation of our approach; it is the path we chose, for the reasons
we outlined here.
C H A P T E R
2
MATLAB Tutorial
The primary goal of this chapter is to help you to become familiar with the MATLABW
software, a powerful tool. It is particularly important to familiarize yourself with the user
interface and some basic functionality of MATLAB. To this end, it is worthwhile to at least
work through the examples in this chapter (actually type them in and see what happens).
Of course, it is even more useful to experiment with the principles discussed in this chapter
instead of just sticking to the examples. The chapter is set up in such a way that it affords
you time to do this.
If desired, you can work with a partner, although it is advisable to select a partner of similar
skill to avoid frustrations and maximize your learning. Advanced MATLAB users can skip this
tutorial altogether, while the rest are encouraged to start at a point where they feel comfortable.
The basic structure of this tutorial is as follows: each new concept is introduced through
an example, an exercise, and some suggestions on how to explore the principles that guide
the implementation of the concept in MATLAB. While working through the examples and
exercises is indispensable, taking the suggestions for exploration seriously is also highly
recommended. It has been shown that negative examples are very conducive to learning;
in other words, it is very important to find out what does not work, in addition to what
does work (the examples and exercises will—we hope—work). Since there are infinite ways
in which something might not work, we can’t spell out exceptions explicitly here. That’s
why the suggestions are formulated very broadly.
7
8 2. MATLAB TUTORIAL
and interactive way to write programs using the Linpack and Eispack libraries of FOR-
TRAN subroutines for matrix manipulation. MATLAB has since evolved to become an
effective and powerful tool for programming, data visualization and analysis, education,
engineering and research.
The strengths of MATLAB include extensive data handling and graphics capabilities,
powerful programming tools and highly advanced algorithms. Although it specializes in
numerical computation, MATLAB is also capable of performing symbolic computation by
having an interface with Maple (a leading symbolic mathematics computing environment).
Besides fast numerics for linear algebra and the availability of a large number of domain-
specific built-in functions and libraries (e.g., for statistics, optimization, image processing,
neural networks), another useful feature of MATLAB is its capability to easily generate var-
ious kinds of visualizations of your data and/or simulation results.
For every MATLAB feature in general, and for graphics in particular, the usefulness of
MATLAB is mainly based on the large number of built-in functions and libraries. The inten-
tion of this tutorial is not to provide a comprehensive coverage of all MATLAB features but
rather to prepare you for your own exploration of its functionality. The online help system is
an immensely powerful tool in explaining the vast collection of functions and libraries
available to you, and should be the most frequently used tool when programming in
MATLAB. Note that this tutorial will not cover any of the functions provided in any of
the hundreds of toolboxes, since each toolbox is licensed separately and their availability
to you can vary. We will indicate in each section if a particular toolbox is required. If you
have additional toolboxes available to you, we recommend using the online help system
to familiarize yourself with the additional functions provided. Another tool for help is the
Internet. A quick online search will usually bring up numerous useful web pages designed
by other MATLAB users trying to help out each other.
As stated previously, MATLAB is essentially a tool—a sophisticated one, but a tool nev-
ertheless. Used properly, it enables you to express and solve computational and analytic
problems from a wide variety of domains. The MATLAB environment combines computa-
tion, visualization, and programming around the central concept of the matrix. Almost
everything in MATLAB is represented in terms of matrices and matrix-manipulations. If
you would like a refresher on matrix-manipulations, a brief overview of the main linear
algebra concepts needed is given in Appendix B, “Linear Algebra Review.” We will start
to explore this concept and its power in detail later in this tutorial. For now, it is important
to note that, properly learned, MATLAB will help you get your job done in a very efficient
way. Giving it a serious shot is worth the effort.
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookname.com