Matlab (eBook)
480 Seiten
Elsevier Science (Verlag)
978-0-08-094325-1 (ISBN)
MATLAB: A Practical Introduction to Programming and Problem Solving discusses the basic programming concepts and skills needed for problem solving using MATLAB software. It is the only book that gives a full introduction to programming in MATLAB combined with an explanation of MATLAB's powerful functions. The book differs from other texts in that it teaches programming concepts and the use of the built-in functions in MATLAB simultaneously. It presents programming concepts and MATLAB built-in functions side-by-side, giving students the ability to program efficiently and exploit the power of MATLAB to solve problems. The systematic, step-by-step approach, building on concepts throughout the book, facilitates easier learning.
Starting with basic programming concepts, such as variables, assignments, input/output, selection, and loop statements, problems are introduced and solved throughout the book. The book is organized into two parts. Part I covers the programming constructs and demonstrates programming versus efficient use of built-in functions to solve problems. Part II describes the applications, including plotting, image processing, and mathematics, needed in basic problem solving. The chapters feature sections called 'Quick Question!' as well as practice problems designed to test knowledge about the material covered. Problems are solved using both 'The Programming Concept' and 'The Efficient Method,' which facilitates understanding the efficient ways of using MATLAB, and also the programming concepts used in these efficient functions and operators. There are also sections on 'common pitfalls' and 'programming guidelines' that direct students towards best practice.
This book is ideal for engineers learning to program and model in MATLAB, as well as undergraduates in engineering and science taking a course on MATLAB.
* Presents programming concepts and MATLAB built-in functions side-by-side, giving students the ability to program efficiently and exploit the power of MATLAB to solve problems.* In depth coverage of file input/output, a topic essential for many engineering applications
* Systematic, step-by-step approach, building on concepts throughout the book, facilitating easier learning
* Sections on 'common pitfalls' and 'programming guidelines' direct students towards best practice
Stormy Attaway is Assistant Professor and Faculty Coordinator for Special Programs within the Mechanical Engineering Department at Boston University. She also currently serves as Director of Curricular Assessment and Improvement for the College of Engineering. In this capacity, she coordinates the curricular assessment and improvement programs within the College, in order to better the academic experience of the undergraduates. She has been the course coordinator for the Engineering Computation courses at Boston University for over twenty years, and has taught a variety of programming courses using many different languages and software packages.
MATLAB: A Practical Introduction to Programming and Problem Solving discusses the basic programming concepts and skills needed for problem solving using MATLAB software. It is the only book that gives a full introduction to programming in MATLAB combined with an explanation of MATLAB's powerful functions. The book differs from other texts in that it teaches programming concepts and the use of the built-in functions in MATLAB simultaneously. It presents programming concepts and MATLAB built-in functions side-by-side, giving students the ability to program efficiently and exploit the power of MATLAB to solve problems. The systematic, step-by-step approach, building on concepts throughout the book, facilitates easier learning. Starting with basic programming concepts, such as variables, assignments, input/output, selection, and loop statements, problems are introduced and solved throughout the book. The book is organized into two parts. Part I covers the programming constructs and demonstrates programming versus efficient use of built-in functions to solve problems. Part II describes the applications, including plotting, image processing, and mathematics, needed in basic problem solving. The chapters feature sections called "e;Quick Question!"e; as well as practice problems designed to test knowledge about the material covered. Problems are solved using both "e;The Programming Concept"e; and "e;The Efficient Method,"e; which facilitates understanding the efficient ways of using MATLAB, and also the programming concepts used in these efficient functions and operators. There are also sections on 'common pitfalls' and 'programming guidelines' that direct students towards best practice. This book is ideal for engineers learning to program and model in MATLAB, as well as undergraduates in engineering and science taking a course on MATLAB. * Presents programming concepts and MATLAB built-in functions side-by-side, giving students the ability to program efficiently and exploit the power of MATLAB to solve problems.* In depth coverage of file input/output, a topic essential for many engineering applications* Systematic, step-by-step approach, building on concepts throughout the book, facilitating easier learning* Sections on 'common pitfalls' and 'programming guidelines' direct students towards best practice
Front Cover 1
Matlab: A Practical Introduction to Programming and Problem Solving 3
Copyright Page 5
Dedication Page 6
Contents 8
Preface 14
Motivation 14
Key Features 15
Side-by-Side Programming Concepts and Built-In Functions 15
Systematic Approach 15
File Input/Output 15
User-Defined Functions 15
Advanced Programming Concepts 16
Problem-Solving Tools 16
Plots, Imaging, and GUIs 16
Layout of Text 16
Pedagogical features 19
Additional book resources 20
Acknowledgments 20
Part 1: Programming and Problem Solving Using MATLAB 22
Chapter 1: Introduction to MATLAB 24
1.1 Getting into MATLAB 25
1.2 Variables and Assignment Statements 27
1.2.1 Initializing, Incrementing, and Decrementing 29
1.2.2 Variable Names 29
1.3 Expressions 31
1.3.1 The Format Function and Ellipsis 31
1.3.2 Operators 32
1.3.3 Built-In Functions and Help 33
1.3.4 Constants 35
1.3.5 Types 35
1.3.6 Random Numbers 37
1.4 Characters and Encoding 39
1.5 Vectors and Matrices 41
1.5.1 Creating Row Vectors 42
1.5.2 Creating Column Vectors 45
1.5.3 Creating Matrix Variables 45
1.5.4 Dimensions 49
1.5.5 Using Functions with Vectors and Matrices 54
1.5.6 Empty Vectors 54
Summary 56
Common Pitfalls 56
Programming Style Guidelines 56
Chapter 2: Introduction to MATLAB Programming 62
2.1 Algorithms 63
2.2 MATLAB Scripts 64
2.2.1 Documentation 66
2.3 Input and Output 67
2.3.1 Input Function 67
2.3.2 Output Statements: disp and fprintf 69
2.4 Scripts with Input and Output 74
2.5 Scripts to Produce and Customize Simple Plots 75
2.5.1 The Plot Function 75
2.5.2 Simple Related Plot Functions 78
2.6 Introduction to File Input/Output (Load and Save) 80
2.6.1 Writing Data to a File 81
2.6.2 Appending Data to a Data File 82
2.6.3 Reading from a File 82
2.7 User-Defined Functions that Return a Single Value 85
2.7.1 Function Definitions 86
2.7.2 Calling a Function 87
2.7.3 Calling a User-Defined Function from a Script 88
2.7.4 Passing Multiple Arguments 88
2.7.5 Functions with Local Variables 89
Summary 90
Common Pitfalls 90
Programming Style Guidelines 91
Chapter 3: Selection Statements 100
3.1 Relational Expressions 101
3.2 The If Statement 103
3.2.1 Representing Logical True and False 107
3.3 The If-Else statement 108
3.4 Nested If-Else Statements 109
3.5 The Switch Statement 114
3.6 The Menu Function 117
3.7 The is Functions in MATLAB 119
Summary 121
Common Pitfalls 121
Programming Style Guidelines 122
Chapter 4: Looping 130
4.1 The for Loop 131
4.1.1 Finding Sums and Products 132
4.1.2 For Loops that Do Not Use the Iterator Variable in the Action 139
4.1.3 Input in a for Loop 140
4.1.4 Input in a for Loop 141
4.2 Nested for Loops 143
4.2.1 Nested Loops and Matrices 147
4.2.2 Combining Nested for Loops and if Statements 151
4.3 Vectorizing 152
4.3.1 Logical Vectors 154
4.3.2 Vectors and Matrices as Function Arguments 161
4.4 While Loops 164
4.4.1 Multiple Conditions in a While Loop 166
4.4.2 Reading from a File in a While Loop 166
4.4.3 Input in a While Loop 168
4.4.4 Counting in a While Loop 169
4.4.5 Error-Checking User Input in a While Loop 170
Summary 173
Common Pitfalls 173
Programming Style Guidelines 174
Chapter 5: MATLAB Programs 182
5.1 More Types of User-Defined Functions 183
5.1.1 Functions that Return More than One Value 183
5.1.2 Functions that Accomplish a Task Without Returning Values 187
5.1.3 Functions that Return Values Versus Printing 188
5.1.4 Passing Arguments to Functions 189
5.2 MATLAB Program Organization 191
5.2.1 Modular Programs 191
5.2.2 Subfunctions 193
5.3 Application: Menu-Driven Modular Program 195
5.4 Variable Scope 203
5.4.1 Persistent Variables 205
5.5 Debugging Techniques 206
5.5.1 Types of Errors 207
5.5.2 Tracing 209
5.5.3 Editor/Debugger 210
5.5.4 Function Stubs 211
Summary 212
Common Pitfalls 212
Programming Style Guidelines 212
Chapter 6: String Manipulation 218
6.1 Creating String Variables 219
6.1.1 Strings as Vectors 219
6.2 Operations on Strings 221
6.2.1 Concatenation 221
6.2.2 Creating Customized Strings 223
6.2.3 Removing Whitespace Characters 227
6.2.4 Changing Case 228
6.2.5 Comparing Strings 228
6.2.6 Finding, Replacing, and Separating Strings 230
6.2.7 Evaluating a String 234
6.3 The is functions for strings 235
6.4 Converting between string and number types 236
Summary 239
Common Pitfalls 239
Programming Style Guidelines 239
Chapter 7: Data Structures: Cell Arrays and Structures 244
7.1 Cell Arrays 245
7.1.1 Creating Cell Arrays 245
7.2 Structures 250
7.2.1 Creating and Modifying Structure Variables 250
7.2.2 Passing Structures to Functions 252
7.2.3 Related Structure Functions 253
7.2.4 Vectors of Structures 255
7.2.5 Nested Structures 262
7.2.6. Nested Structures 262
Summary 266
Common Pitfalls 266
Programming Style Guidelines 266
Chapter 8: Advanced File Input and Output 274
8.1 Lower Level File I/O Functions 275
8.1.1 Opening and Closing a File 275
8.1.2 Reading from Files 276
8.1.3 Writing to Files 283
8.1.4 Appending to Files 285
8.2 Writing and Reading Spreadsheet Files 285
8.3 Using MAT-Files for Variables 287
8.3.1 Writing Variables to a File 287
8.3.2 Appending Variables to a MAT-File 288
8.3.3 Reading from a MAT-File 288
Summary 289
Common Pitfalls 289
Programming Style Guidelines 289
Chapter 9: Advanced Functions 294
9.1 Anonymous Functions 294
9.2 Uses of Function Handles 296
9.2.1 Function Functions 297
9.3 Variable Numbers of Arguments 299
9.3.1 Variable Number of Input Arguments 300
9.3.2 Variable Number of Output Arguments 301
9.4 Nested Functions 305
9.5 Recursive Functions 308
Summary 312
Common Pitfalls 312
Programming Style Guidelines 312
Part 2: Applications 316
Chapter 10: MATLAB Plots 318
10.1 Plot Functions 318
10.1.1 Matrix of Plots 319
10.1.2 Plot Types 320
10.2 Animation 323
10.3 Three-Dimensional Plots 324
10.4 Customizing Plots 325
10.5 Graphics Properties 327
10.6 Plot Applications 329
10.6.1 Plotting from a Function 329
10.6.2 Plotting File Data 330
Summary 333
Common Pitfalls 333
Programming Style Guidelines 334
Chapter 11: Solving Systems of Linear Algebraic Equations 342
11.1 Matrix Definitions 343
11.1.1 Matrix Properties 343
The Programming Concept 343
The Efficient Method 344
11.1.2 Square Matrices 345
The Programming Concept 345
The Efficient Method 346
The Efficient Method 347
The Efficient Method 348
11.1.3 Matrix Operations 349
The Programming Concept 349
The Efficient Method 350
11.1.4 Matrix Multiplication 351
The Programming Concept 351
The Efficient Method 352
11.1.5 Vector Operations 355
11.2Matrix Solutions to Systems of Linear Algebraic Equations 357
11.2.1 Solving 2 × 2 Systems of Equations 359
The Programming Method 361
The Efficient Method 361
11.2.2 Gauss, Gauss-Jordan Elimination 362
11.2.3 Reduced Row Echelon Form 368
11.2.4 Finding a Matrix Inverse by Reducing an Augmented Matrix 369
11.3 Symbolic Mathematics 369
11.3.1 Symbolic Variables and Expressions 370
11.3.2 Simplification Functions 371
11.3.3 Displaying Expressions 372
11.3.4 Solving Equations 373
Summary 375
Common Pitfalls 375
Programming Style Guidelines 375
Chapter 12: Basic Statistics, Searching, and Sorting 382
12.1 Statistical Functions 383
12.1.1 Mean 384
The Programming Concept 384
The Efficient Method 385
12.1.2 Variance and Standard Deviation 387
12.1.3 Mode 388
12.1.4 Median 389
12.2 Set Operations 389
12.3 Sorting 393
The Programming Concept 394
The Efficient Method 395
12.3.1 Sorting Vectors of Structures 395
12.3.2 Sorting Strings 398
12.4 Indexing 400
12.4.1 Indexing into Vectors of Structures 402
12.5 Searching 403
12.5.1 Sequential Search 403
12.5.2 Binary Search 404
Summary 407
Common Pitfalls 407
Programming Style Guidelines 408
Chapter 13: Sights and Sounds 414
13.1 Sound Files 414
13.2 Introduction to Handle Graphics 416
13.2.1 Graphics Objects and Their Properties 416
13.3 Image Processing 421
13.4 Introduction to Graphical User Interfaces 426
Summary 435
Common Pitfalls 435
Programming Style Guidelines 435
Chapter 14: Advanced Mathematics 442
14.1 Fitting Curves to Data 442
14.1.1 Polynomials 443
14.1.2 Curve Fitting 444
14.1.3 Interpolation and Extrapolation 444
14.1.4 Least Squares 447
14.2 Complex Numbers 450
14.2.1 Equality for Complex Numbers 452
14.2.2 Adding and Subtracting Complex Numbers 452
The Programming Concept 453
The Efficient Method 453
14.2.3 Multiplying Complex Numbers 453
14.2.4 Complex Conjugate and Absolute Value 454
14.2.5 Complex Equations Represented as Polynomials 454
14.2.6 Polar Form 455
14.2.7 Plotting 455
14.3 Calculus: Integration and Differentiation 456
14.3.1 Trapezoidal Rule 456
The Programming Concept 457
The Efficient Method 457
The Programming Concept 457
The Efficient Method 458
14.3.2 Differentiation 458
14.3.3 Calculus in Symbolic Math Toolbox 459
Summary 460
Common Pitfalls 460
Programming Style Guidelines 460
Index 468
Erscheint lt. Verlag | 5.3.2009 |
---|---|
Sprache | englisch |
Themenwelt | Mathematik / Informatik ► Informatik ► Programmiersprachen / -werkzeuge |
Mathematik / Informatik ► Mathematik ► Angewandte Mathematik | |
Mathematik / Informatik ► Mathematik ► Computerprogramme / Computeralgebra | |
Technik ► Elektrotechnik / Energietechnik | |
ISBN-10 | 0-08-094325-X / 008094325X |
ISBN-13 | 978-0-08-094325-1 / 9780080943251 |
Haben Sie eine Frage zum Produkt? |
Kopierschutz: Adobe-DRM
Adobe-DRM ist ein Kopierschutz, der das eBook vor Mißbrauch schützen soll. Dabei wird das eBook bereits beim Download auf Ihre persönliche Adobe-ID autorisiert. Lesen können Sie das eBook dann nur auf den Geräten, welche ebenfalls auf Ihre Adobe-ID registriert sind.
Details zum Adobe-DRM
Dateiformat: EPUB (Electronic Publication)
EPUB ist ein offener Standard für eBooks und eignet sich besonders zur Darstellung von Belletristik und Sachbüchern. Der Fließtext wird dynamisch an die Display- und Schriftgröße angepasst. Auch für mobile Lesegeräte ist EPUB daher gut geeignet.
Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen eine
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen eine
Geräteliste und zusätzliche Hinweise
Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.
aus dem Bereich