MATLAB for Behavioral Scientists / Edition 1

MATLAB for Behavioral Scientists / Edition 1

by David A. Rosenbaum, Brad Wyble
     
 

View All Available Formats & Editions

ISBN-10: 0805862277

ISBN-13: 9780805862270

Pub. Date: 03/13/2007

Publisher: Taylor & Francis


About the Author:
David A. Rosenbaum is Distinguished Professor of Psychology at The Pennsylvania State University, University Park, PA

Overview


About the Author:
David A. Rosenbaum is Distinguished Professor of Psychology at The Pennsylvania State University, University Park, PA

Product Details

ISBN-13:
9780805862270
Publisher:
Taylor & Francis
Publication date:
03/13/2007
Pages:
288
Product dimensions:
7.00(w) x 10.00(h) x 0.69(d)

Table of Contents


Preface     xiii
Introduction     1
Getting Oriented     1
Getting an Overview of This Book     2
Understanding Computer Architecture     4
Approaching the Task of Programming     6
Deciding Whether a Program is Needed and if You Should Write It     6
Being as Clear as Possible About What Your Program Should Do     7
Working Incrementally     9
Being Open to Negative Feedback     9
Programming With a Friend     12
Writing Concise Programs     12
Writing Clear Programs     13
Understanding How the Chapters of This Book are Organized     14
Using the Web Site Associated With This Book     15
Acknowledging Limits     15
Interacting With MATLAB     17
Using MATLAB's Windows     18
Using the Command Window     18
Writing Tiny Programs in the Command Window     20
Allowing or Suppressing Outputs by Omitting or Including End-of-Line Semicolons     23
Editing, Saving, and Running MATLAB Programs     24
Running and Debugging MATLAB Programs     26
Keeping a Diary     26
Practicing Interacting with MATLAB     27
Matrices     29
Creating Matrices     29
Locating Elements of Matrices     31
Concatenating Matrices     34
Determining the Size of a Matrix     35
Transposing a Matrix     37
Creating Matrices with Shorthand Methods     39
Checking the Status of Matrices     42
Clearing and Emptying Matrices     43
Practicing with Matrices     46
Calculations     49
Adding, Subtracting, Multiplying, Dividing Values, and Raising Values to a Power     50
Using Built-in Functions to Compute the Square Root, Remainder, Absolute Value, Base of the Natural Logarithms Raised to a Power, and the Logarithm     52
Ordering Calculations     56
Performing Statistical Calculations to Obtain the Sum, Mean, Standard Deviation, Variance, Correlation, and Least-Squares Fit     57
Performing Statistical Calculations With Missing Data     59
Calculating with Matrices     61
Using Matrix Algebra     64
Obtaining the Max, Min, Sort, Round, Floor, and Ceiling     64
Generating Random Numbers     70
Generating Magic Squares and Calendars     71
Practicing Calculations     72
Contingencies      75
Using the if...else...end Construct     76
Using the switch....case...end Construct     80
Using the for...end construct     82
Using the while...end Construct and Escaping From Runaway Loops     86
Vectorizing Rather Than Using for...end     89
If-ing Instantly     90
If-ing Instantly Once Again and Finding Indices of Satisfying Values     92
Practicing Contingencies     93
Input-Output     95
Copying and Pasting Data By Hand     96
Getting Input From a User and Displaying the Result     97
Pausing     99
Recording Reaction Times and Other Delays With tic...toc     100
Formatting Numbers for Screen Outputs     101
Assigning Arrays of Literal Characters (Strings) to Variables     103
Converting Numbers to Strings, and Concatenating Strings     106
Comparing Strings     107
Evaluating Strings and Generating Numbered Variables on the Fly     108
Controlling File Print Formats     110
Writing Data to Named Files     113
Checking and Changing the Current Directory     114
Reading Data Saved as Plain Text     116
Reading Data From and Writing Data to Excel Spreadsheets      117
Taking Precautions Against Overwriting Files     117
Learning More About input and output     118
Practicing input-output     118
Data Types     121
Identifying Strings, Numbers of Different Types, and Booleans     121
Converting Characters to Numbers and Vice Versa     124
Creating and Accessing Cells     123
Creating and Accessing Structures     128
Practicing Data Types     132
Modules and Functions     133
Taking a Top-Down Approach to Programming by Using Modules     133
Writing and Using General-Purpose Functions     139
Getting Multiple Outputs From Functions     142
Giving Multiple Inputs to Functions     143
Creating Subfunctions     145
Calling Functions Properly     146
Drawing on Previously Defined Functions Versus Creating Your Own     147
Practicing Modules and Functions     147
Plots     149
Deciding to Plot Data and, for Starters, Plotting a Sine Function     150
Controlling Axes     152
Controlling the Appearance of Plotted Points and Lines     154
Having More Than One Graph Per Plot and More Types of Points and Lines     155
Getting and Setting Properties of Plotted Points     157
Adding xlabels, ylabels, and titles     160
Adding Legends     161
Adding Text     162
Fitting Curves     163
Creating Subplots and Turning Grids, Boxes, and Axes On and Off     166
Exploiting Matrix Assignments to Merge Subplots     167
Getting and Setting Properties of Axes     168
Plotting Data Points With Error Bars     172
Generating Polar Plots     173
Generating Histograms     174
Generating Bar Graphs     175
Exporting and Printing Figures     176
Generating Other Kinds of Graphs and Getting and Setting Figure Properties     177
Practicing Plots     178
Lines, Shapes, and Images     181
Generating Lines     180
Forming and Filling Shapes     185
Loading Images     187
Clicking in Figure Windows To Add Graphics, Add Text, or Record Responses     189
Saving and Reloading Figures     191
Practicing Lines, Shapes, and Images     191
Three-Dimensional Graphics     193
Generating Three-Dimensional Bar Graphs     194
Plotting in Three Dimensions     195
Plotting "Above" a Meshgrid     195
Plotting "Meshy" Data     196
"Surfing" the "Web"     197
Changing Points of View     201
Generating Contours     202
Checking Your Understanding of Meshgrid-Based Graphing     203
Generating Rectangular Solids     207
Generating Spheres and Cylinders     208
Generating Ellipsoids     211
Practicing 3D Graphics     217
Animations     219
Animating by Whiting Out Successive Images     219
Watching Comets     221
Animating by Drawing Now     221
Making Movies     222
Saving Movies     223
Reading and Running Previously Saved Movies     223
Practicing Animation     225
Sound     227
Playing Beeps     227
Loading and Playing Other Sound Files     228
Controlling Volume     229
Staggering or Overlapping Sounds and Delaying Sounds     230
Controlling Volume While Staggering or Overlapping Sounds     232
Creating Your Own Sound Files Computationally     232
Writing and Reading Files For Sound     236
Learning More About Sound-Related Functions      236
Practicing Sounds     236
Going On     239
Profiling Program Efficiency     239
Opening and Editing Math Works-Supplied Functions     239
Using Toolboxes From the MathWorks and Other Sources     240
Creating Your Own Toolboxes     240
Creating Graphical User Interfaces (GUIs)     240
Creating Stand-Alone Applications     241
Reading Further     241
References     243
Solutions To Selected Problems     245
Author Index     259
Subject Index     261

Customer Reviews

Average Review:

Write a Review

and post it to your social network

     

Most Helpful Customer Reviews

See all customer reviews >