Learning to Program with MATLAB: Building GUI Tools

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Author Craig Lent’s 1st edition of Learning to Program with MATLAB: Building GUI Tools teaches the core concepts of computer programming, such as arrays, loops, function, basic data structures, etc., using MATLAB. The text has a focus on the fundamentals of programming and builds up to an emphasis on GUI tools, covering text-based programs first, then programs that produce graphics. This creates a visual expression of the underlying mathematics of a problem or design. Brief and to-the-point, the text includes material that can be converted with supplementary reference material designed to entice users to retain their copy.

Author(s): Craig S. Lent
Edition: 1
Publisher: Wiley
Year: 2013

Language: English
Pages: 308

Cover......Page 1
Title Page......Page 3
Copyright Page......Page 4
Contents......Page 7
Preface......Page 11
I: MATLAB Programming......Page 15
1: Getting Started......Page 17
Manipulating windows......Page 18
1.2: MATLAB variables......Page 19
Variable assignment statements......Page 21
Variable names......Page 22
1.3: Numbers and functions......Page 23
1.5: Writing simple MATLAB scripts......Page 25
1.7: Using the debugger......Page 28
2: Strings and Vectors......Page 34
2.1: String basics......Page 35
2.3: Getting information from the user......Page 36
2.4: Vectors......Page 37
2.5: Operations on vectors......Page 38
2.6: Special vector functions......Page 41
Statistical functions......Page 42
2.7: Using rand and randi......Page 43
3: Plotting......Page 48
3.1: The plot command......Page 49
3.2: Tabulating and plotting a simple function......Page 53
3.3: Bar graphs and histograms......Page 57
Multiple plots with a single plot command......Page 60
Combining multiple plots with a hold command......Page 62
3.5: Adding lines and text......Page 65
4: Matrices......Page 70
4.1: Entering and manipulating matrices......Page 71
4.2: Operations on matrices......Page 74
4.3: Solving linear systems: The backslash operator......Page 79
Extended example: Solving circuit problems......Page 80
4.4: Special matrix functions......Page 86
5: Control Flow Commands......Page 89
5.1: Conditional execution: The if statement......Page 90
5.2: Logical expressions......Page 93
5.3: Logical variables......Page 95
5.4: for loops......Page 96
5.5: while loops......Page 99
Switch-case statement......Page 101
Break statement (not recommended)......Page 102
6: Animation......Page 108
6.1: Basic animation......Page 109
6.2: Animating function plots......Page 113
One-dimensional motion: Constant speed......Page 117
Motion with constant acceleration......Page 120
Time-marching dynamics: Nonconstant force......Page 123
7: Writing Your Own MATLAB Functions......Page 131
7.1: MATLAB function files......Page 132
Declaring MATLAB functions......Page 133
7.3: Local workspaces......Page 134
7.6: Other functional forms......Page 135
Subfunctions......Page 136
Nested functions......Page 141
Anonymous functions......Page 142
8: More MATLAB Data Classes and Structures......Page 151
8.1: Cell arrays......Page 152
8.2: Structures......Page 153
8.3: Complex numbers......Page 154
8.5: Other data classes and data structures......Page 155
II: Building GUI Tools......Page 159
9.1: Getting started with GUIDE......Page 161
Saving the GUI to file......Page 164
9.2: Starting an action with a GUI element......Page 165
Building SliderTool......Page 168
Communicating with GUI elements from the command line......Page 171
9.4: Synchronizing information with a GUI element......Page 175
9.5: Key points from this chapter......Page 177
10: Transforming a MATLAB Program into a GUI Tool......Page 179
10.1: Creating a GUI tool step by step......Page 180
10.2: Further GUI design considerations......Page 191
11: GUI Components......Page 203
III: Advanced Topics......Page 221
12: More GUI Techniques......Page 223
12.1: Waitbars......Page 224
Saving and loading data in .mat files......Page 225
A GUI interface to file names using uiputfile and uigetfile......Page 226
12.3: Reading and writing formatted text files......Page 229
12.4: The input dialog......Page 233
12.5: The question dialog......Page 234
12.6: Sharing application data between functions......Page 235
12.7: Responding to keyboard input......Page 236
Mouse-click response......Page 237
Mouse events and object dragging......Page 239
12.9: Creating menus in GUIDE......Page 242
13: More Graphics......Page 246
13.1: Logarithmic plots......Page 247
13.2: Plotting functions on two axes......Page 250
13.3: Plotting surfaces......Page 251
13.4: Plotting vector fields......Page 257
Importing and manipulating bit-mapped images......Page 259
Placing images on surface objects......Page 267
13.6: Rotating composite objects in three dimensions......Page 268
14: More Mathematics......Page 274
Derivatives of mathematical functions expressed as MATLAB functions......Page 275
Derivatives of tabulated functions......Page 277
Integrating tabulated functions......Page 279
Integrating mathematical functions expressed as MATLAB functions......Page 284
14.3: Zeros of a function of one variable......Page 287
Finding a minimum of a function of one variable......Page 289
Multidimensional minimization......Page 291
Fitting to an arbitrary function by multidimensional minimization......Page 292
Solving simultaneous nonlinear equations by multidimensional minimization......Page 295
14.5: Solving ordinary differential equations......Page 298
14.6: Eigenvalues and eigenvectors......Page 303
Appendix A: Hierarchy of Handle Graphics Objects......Page 307
Appendix B: Using LATEX Commands......Page 309
Index......Page 315