Mauro Borgo,
Alessandro Soranzo and Massimo GrassiMATLAB for Psychologists201210.1007/978-1-4614-2197-9©
Springer Science+Business Media, LLC 2012
Mauro Borgo, Alessandro Soranzo
and Massimo Grassi
MATLAB for
Psychologists

Mauro Borgo
Via Marosticana 168, Dueville, VI,
Italy
Alessandro Soranzo
School of Social Science & Law,
University of Teesside, Middlesbrough, UK
Massimo Grassi
Department of General Psychology,
University of Padova, Padova, Italy
ISBN 978-1-4614-2196-2e-ISBN 978-1-4614-2197-9
Springer New York Dordrecht
Heidelberg London
Library of Congress Control
Number: 2012931943
© Springer Science+Business Media, LLC
2012
This work is
subject to copyright. All rights are reserved by the Publisher,
whether the whole or part of the material is concerned,
specifically the rights of translation, reprinting, reuse of
illustrations, recitation, broadcasting, reproduction on microfilms
or in any other physical way, and transmission or information
storage and retrieval, electronic adaptation, computer software, or
by similar or dissimilar methodology now known or hereafter
developed. Exempted from this legal reservation are brief excerpts
in connection with reviews or scholarly analysis or material
supplied specifically for the purpose of being entered and executed
on a computer system, for exclusive use by the purchaser of the
work. Duplication of this publication or parts thereof is permitted
only under the provisions of the Copyright Law of the Publisher’s
location, in its current version, and permission for use must
always be obtained from Springer. Permissions for use may be
obtained through RightsLink at the Copyright Clearance Center.
Violations are liable to prosecution under the respective Copyright
Law.
The use of
general descriptive names, registered names, trademarks, service
marks, etc. in this publication does not imply, even in the absence
of a specific statement, that such names are exempt from the
relevant protective laws and regulations and therefore free for
general use.
While the advice and
information in this book are believed to be true and accurate at
the date of publication, neither the authors nor the editors nor
the publisher can accept any legal responsibility for any errors or
omissions that may be made. The publisher makes no warranty,
express or implied, with respect to the material contained
herein.
Printed on acid-free
paper
Springer is part
of Springer Science+Business Media (www.springer.com)
To my three women: my wife, Tatiana, my
mother, Angelina, and my grandmother Emilia
–Mauro Borgo
To my father
–Alessandro Soranzo
To Viola and Ruggero
–Massimo Grassi
Preface
Psychological researchers should possess several
skills, and one of them is surely creativity. Creativity is needed
at several key points of the research process, such as in creating
experimental stimuli and planning and designing an experiment.
Creativity drives good data analysis, so that numbers can reveal
their full potential.
Much of this creativity is now expressed through
a computer program. For example, in planning and designing a
psychological experiment and in analyzing data, we use specific
software that has been dedicated to that particular job. This
software might, however, be a hindrance to creativity, preventing
it from permeating research. This is because in the majority of
cases, software is designed to satisfy the average user and it is
not flexible enough to meet specific needs.
In this sense, MATLAB is exactly the other side
of the coin. When we first open the software, the lack of a
graphical interface may be frustrating: at a first glance, the
program may seem difficult to use. This book is aimed at helping
users in their first approaches to this software, to aid them in
programming their psychological experiments and consequently in
liberating their creativity. And this is MATLAB’s major advantage:
we do not have to adapt our needs to the software; it is the
software that adapts to our needs.
MATLAB is an extremely powerful research tool. By
means of this single software tool we can control every step of our
research. We can create stimuli of any kind (e.g., pictures,
sounds), and we can program psychological experiments, calculate
statistics, run simulations, and do any kind of signal or biosignal
processing. In brief, the flexibility of this software lets us to
control and customize every conceivable step of our research
requiring a computer program. Moreover, knowledge of MATLAB will
help you to find a postdoc in experimental psychology after
completing the Ph.D. In many cases, research groups look for
researchers with good MATLAB programming skills.
The current text is written to help the newcomer
in using MATLAB for research in experimental psychology. However,
the content can be transferred to any application. The reader can
find the scripts written in this book at the following web page:
http://www.psy.unipd.it/~grassi/matlab_book.html
A final recommendation for the reader: do not
begin to work with MATLAB without a goal. Our teaching experience
suggests that having a goal greatly accelerates your learning.
Therefore, think immediately about the amazing custom code you need
to complete your state-of-the-art research. That code is here in
this book, waiting to be written by you.
Mauro Borgo
Alessandro Soranzo
Massimo Grassi
Acknowledgments
Thanks to Professor Silvano Pupolin for his
support.
Contents
Summary 100
Exercises 101
Analysis 104
References 106
Suggested
Readings106
5 A
Better Sound 107
Generate a Sound 107
Multiple Sounds 112
Sound Filtering 120
Sound Analysis 123
Summary 125
Exercises 125
References 127
Suggested
Readings128
7 Data
Analysis 153
Covariance 156
Categorical Data 177
Ordinal Data 179
Summary 184
Exercises 185
References 187
Suggested
Readings187
Introduction 189
GUIDE 189
Starting GUIDE 190
Appendix 215
The File Menu 216
The Edit Menu 216
The View Menu 217
The Layout Menu 217
Tools Menu 218
Help 218
Analysis 225
Closing 230
Drawing Text 236
Importing Images 238
Analysis 239
References 248
Suggested
Readings248
Timing 249
Priority 250
Sound Functions 251
Mouse Input 262
Summary 267
Exercises 268
Exercise 1 268
References 272
Suggested
Readings273
About the
Authors275
Index277