Learning to Program with MATLAB: Building GUI Tools
Buy Rights Online Buy Rights

Rights Contact Login For More Details

More About This Title Learning to Program with MATLAB: Building GUI Tools

English

The text is for instructors who want to use MATLAB to teach introductory programming concepts. Since many students struggle with applying the concepts that underlie good programming practice,  Learning to Program with MATLAB: Building GUI Tools was designed upon the observation that student learning is enhanced if the students themselves build the GUI (graphical user interface) tool, construct the computational model, implement the visualization of results, and design the GUI. This text teaches the core concepts of computer programming—arrays, loops, functions, and basic data structures—using MATLAB. The chapter sequence covers text-based programs, then programs that produce graphics, building up to an emphasis on GUI tools. This progression unleashes the real power of MATLAB—creating visual expressions of the underlying mathematics of a problem or design.

English

Craig S. Lent is the author of Learning to Program with MATLAB: Building GUI Tools, published by Wiley.

English

Preface ix

I MATLAB Programming 1

1 Getting Started 3

1.1 Running the MATLAB IDE 4

Manipulating windows 4

1.2 MATLAB variables 5

1.3 Numbers and functions 9

1.4 Documentation 11

1.5 Writing simple MATLAB scripts 11

1.6 A few words about errors and debugging 14

1.7 Using the debugger 14

2 Strings and Vectors 20

2.1 String basics 21

2.2 Using the disp command to print a variable’s value 22

2.3 Getting information from the user 22

2.4 Vectors 23

2.5 Operations on vectors 24

2.6 Special vector functions 27

2.7 Using rand and randi 29

3 Plotting 34

3.1 The plot command 35

3.2 Tabulating and plotting a simple function 39

3.3 Bar graphs and histograms 43

3.4 Drawing several plots on one graph 46

3.5 Adding lines and text 51

4 Matrices 56

4.1 Entering and manipulating matrices 57

4.2 Operations on matrices 60

4.3 Solving linear systems: The backslash operator 65

4.4 Special matrix functions 72

5 Control Flow Commands 75

5.1 Conditional execution: The if statement 76

5.2 Logical expressions 79

5.3 Logical variables 81

5.4 for loops 82

5.5 while loops 85

5.6 Other control flow commands 87

6 Animation 94

6.1 Basic animation 95

6.2 Animating function plots 99

6.3 Kinematics of motion 103

7 Writing Your Own MATLAB Functions 117

7.1 MATLAB function files 118

7.2 Function inputs and outputs 120

7.3 Local workspaces 120

7.4 Multiple outputs 121

7.5 Function files 121

7.6 Other functional forms 121

8 More MATLAB Data Classes and Structures 137

8.1 Cell arrays 138

8.2 Structures 139

8.3 Complex numbers 140

8.4 Function handles 141

8.5 Other data classes and data structures 141

II Building GUI Tools 145

9 Building a Graphical User Interface 147

9.1 Getting started with GUIDE 147

9.2 Starting an action with a GUI element 151

9.3 Communicating with GUI elements 154

9.4 Synchronizing information with a GUI element 161

9.5 Key points from this chapter 163

10 Transforming a MATLAB Program into a GUI Tool 165

10.1 Creating a GUI tool step by step 166

10.2 Further GUI design considerations 177

11 GUI Components 189

III Advanced Topics 207

12 More GUI Techniques 209

12.1 Waitbars 210

12.2 File dialogs 211

12.3 Reading and writing formatted text files 215

12.4 The input dialog 219

12.5 The question dialog 220

12.6 Sharing application data between functions 221

12.7 Responding to keyboard input 222

12.8 Making graphic objects interactive 223

12.9 Creating menus in GUIDE 228

13 More Graphics 232

13.1 Logarithmic plots 233

13.2 Plotting functions on two axes 236

13.3 Plotting surfaces 237

13.4 Plotting vector fields 243

13.5 Working with images 245

13.6 Rotating composite objects in three dimensions 254

14 More Mathematics 260

14.1 Derivatives 261

14.2 Integration 265

14.3 Zeros of a function of one variable 273

14.4 Function minimization 275

14.5 Solving ordinary differential equations 284

14.6 Eigenvalues and eigenvectors 289

AppendixA: Hierarchy of Handle Graphics Objects 293

Appendix B: Using LATEXCommands 295

Index 301

loading