# Physical Modeling in MATLAB

Allen Downey, Franklin W. Olin College of Engineering

Copyright Year: 2009

Publisher: Green Tea Press

Language: English

## Read this book

## Conditions of Use

Free Documentation License (GNU)

Free Documentation License (GNU)

## Reviews

This text provides a solid introduction to MATLAB programming and solving pertinent physical or engineering problems using the software. The concepts covered are in my view ideal for an introductory engineering course in MATLAB. The concepts... read more

This text provides a solid introduction to MATLAB programming and solving pertinent physical or engineering problems using the software. The concepts covered are in my view ideal for an introductory engineering course in MATLAB. The concepts discussed are easily adapted into multiple engineering fields so this text could become a handy reference beyond the class initially intended.

Text is accurate and previously found mistakes are included in a provided errata.

The code and programming statements are up to date. The text is written in a manner that updating for subsequent versions of MATLAB will not detract from the overall quality or effectiveness of the text as a guide.

I have used or previewed a number of texts for my Introduction to Engineering Computation course. I believe this one has the best chance of connecting with my students, the majority of which are novice programmers who likely have no prior MATLAB experience.

This book uses a consistent tone and pattern throughout which I believe will help students to first understands the concepts and then build into the applications.

The text is organized into manageable conceptual blocks. The sequence of organization is consistent with an introductory MATLAB course or a MATLAB handbook. The chapters could relatively easily be rearranged to change the topic of focus more quickly for other classes if desired.

This book's organization is a strong point to me. I like starting with the concept of MATLAB as a glorified calculator and then step by step addressing its more expansive and powerful features, This allows, in my view, the students to form needed foundations before being thrown into the deep end of complex programming and numerical analysis.

My one drawback with the book's interface is in sections early on where plotting is discussed. Images of the plots in questions and the plotting process could be more frequent. Otherwise the content is presented in a very useful and accessible manner.

There are no noticeable errors, and the text is easy to follow.

The text is written in an unbiased way and make no references which may be considered culturally insensitive.

This book contains the most basic function and operations in Matlab for physical modeling and calculations. read more

This book contains the most basic function and operations in Matlab for physical modeling and calculations.

The physical modeling part is not very comprehensive. More 3D model and plots are needed.

The contents of the book are more relevant to the introduction to Matlab, than physical modeling.

The clarity is very clear and concise.

The terminology is consistent in this book.

The modularity of this book is not very good. Different chapters cannot be separated and recombined.

The logical of the topics is clear and understandable.

The number of figures in this book is small. More 3D colorful figures may be useful for attracting students.

There are no obvious grammatical errors.

The contents of this book are culturally insensitive.

Numerical interpolation, extrapolation and fitting of data should be included in this book, as it is for the physical modeling.

This book covers the fundamentals of MATLAB essential for beginners to conduct numerical analysis. It is user friendly and easy to use. It would be great if this book has sections to explain file input/output, file formatting, handling graphs and... read more

This book covers the fundamentals of MATLAB essential for beginners to conduct numerical analysis. It is user friendly and easy to use. It would be great if this book has sections to explain file input/output, file formatting, handling graphs and a little more depth in physical modeling from the physical viewpoint. The modeling part discusses mainly how to solve differential equations focusing on the integration of the function. It could use other typical problems such as wave equations, state-space representation and analysis, etc (it is unfortunate that Chapter 12 has a short description about “State Vectors” but it does not elaborate on their usage or examples).

I do not found any error in this book. Chapters are mostly written concisely and accurately. I found one minor error: “For example, if we know that f(0) = 5 billion cells, then we can write f(0) = 5 =b e^a0 (Near the end of section 8.1.)

This book can be used as a quick guide to check the syntax and usage of MATLAB commands/statement when writing a script, or as a reference to understand various concepts of mathematical operations handled by MATLAB. I have been using MATLAB over 15 years but found some new features of MATLAB in this book.

This book explains basics of MATLAB clearly. I recommend my students to refer to this book before reading any MATLAB reference manuals. Each concept of MALAB is concisely described in a logical way.

Most chapters are written in the same format. This makes easy to find the part in a chapter that is relevant to a given problem to solve. The glossary section at the end of chapter is concise and helpful. The chapters for Physical Modeling could be in a bit more detail.

Most chapters are written in the right length and depth. Chapter 8 could go a bit deeper in the physical content. The chapter is very good from the practical point of view.

The entire book could be divided into two parts; part 1 for MATLAB usage and part 2 for Physical Modeling. Part 2 could be elaborated. “7.2 Physical modeling” does not fit to the flow. Physical modeling could be a stand-alone section and be beefed up. Sections “12.1 What is a vector?”, “12.2 Dot and cross products”, and “12.4 Animation” provide general topics and comments on vectors. These sections could be included in Chapter 4 “Vectors”. Section “12.6 What is a model for?” could be at the beginning of modeling (Chapter 8).

I do not find any interface related issue.

I do not find any grammatical error.

I do not find culturally any insensitive or offensive element in this book.

Overall, this book is very helpful to our students. I am planning to use this book in our “Computational Methods in Physics” course in the next fall semester. I also encourage my research students to read this book as a reference guide.

The text covers the major topics that a typical MATLAB course should contain. The glossary section in each chapter provides a powerful tool for the student to recap the chapter and identify the concepts again read more

The text covers the major topics that a typical MATLAB course should contain. The glossary section in each chapter provides a powerful tool for the student to recap the chapter and identify the concepts again

Content is accurate and the text is error free.

The content is up -to-date. The general body of the software has had subtle changes over the years, thus it is highly unlikely that this material and narration will be obsolete any time soon, Thus, if new edits or updates are to appear in the future, it would be easy to include them in the text

The authors use simple language with as possible layman terms as the text/topic allows. When jargon are used, the authors typically elaborate on them.

The text is consistent, headlines are consistent with the text accompanying them. Both terminology and framework are consistent

The text is divided into many subheadings that target multiple ideas under each chapter. The text under each section is of reasonable size for the students to follow. In particular, I think the error's sections in the first four chapters are of great importance. Students typically run into several types of errors (syntax, run-time, logical, etc), and these sections work pro-actively by simulating usual mistakes encountered by students.

I think that vectors' chapter (Chapter 4) would be better swapped with the Loops chapter (Chapter 3). Loops require knowledge of vectors and indexing prior to start using them. In addition, the text lacks multiple exercise opportunities for the students to practice their understanding. I would suggest adding more exercises to each chapter.

No interface issues were noticed

I didn't find any grammatical errors in the text

The text is not culturally insensitive or offensive in any way. It should make use of examples that are inclusive of a variety of races, ethnicities, and backgrounds.

The course provides a reference for students to start using MATLAB. It gradually builds on knowledge that was presented in the earlier sections and chapters. It might need a re-arrangement of sections and the inclusion of additional practice problems, but overall it is a very good resource for MATLAB

The text covers introductory programming appropriately and is an excellent resource for students with no programming background. The author tends to focus on an application and using programming methods to make the job of the programmer easier. ... read more

The text covers introductory programming appropriately and is an excellent resource for students with no programming background. The author tends to focus on an application and using programming methods to make the job of the programmer easier. While this can be a great tool for a beginner, it can make the organization of the book difficult. There were times when I was concerned that the author introduced a fundamental concept quite late in the book. For example, if statements are covered in Chapter 4: Vectors, which did not seem to be an intuitive place for me to find this content. There were also times when the author glossed over the function of a bit of code, opting instead that it follow the correct form. For example, when talking about the MATLAB differential equation solver, the author did not include to much detail into the role of a function handle. However, the author talked about potential problems associated with the function handle (here, it must be an anonymous function), focusing solely on the syntax of the code.

The content of the book is accurate and unbiased.

The content is up-to-date. Furthermore, it looks like the text is arranged in such a way that updates to the code would be relatively straightforward to implement.

The author writes in a very informal voice, which makes the text much more readable and accessible to the beginning programmer. I appreciate that technical terminology is summarized in the Glossary, found at the end of each chapter.

The text is internally consistent in its use of terminology. I also appreciate the consistency of each chapter, with a Glossary of terms and supporting Exercises at the end of each chapter.

The book would really serve students well if they were to read the text in its entirety in the order in which it is presented. The later chapters are rather long and difficult to break up into smaller sections, as each subsection often relies on a previous subsection.

The author generally presents each topic as a solution to a problem from a previous implementation, so there is a clear application of the programming method being discussed. My only concern is that students may not generalize the uses of the programming method, focusing only on the way it is implemented.

On the online version, the border demarcating an equation was distracting. However, the author did a good job of making sure that the code was distinct from the rest of the text.

The text was free of grammatical errors.

The text is not culturally insensitive or offensive in any way.

I would consider using this book in my Computational Methods course. My only concern is that this book's organization is a bit different from the way my course is currently laid out and I don't think the book is particularly modular.

This book covers introductory programming with MATLAB in a methodical manner. This textbook was perfect for students who did not have a programming background. The text did a nice job summarizing chapters and explaining terms and methods in a... read more

This book covers introductory programming with MATLAB in a methodical manner. This textbook was perfect for students who did not have a programming background. The text did a nice job summarizing chapters and explaining terms and methods in a non-programming language. Perfect for my introductory course.

I used this textbook in conjunction with FreeMAT, the free version of MATLAB. There were a few functions that did not translate into FreeMAT. This was a unique situation for the free version of MATLAB. Other than that, the textbook was well-written and error-free.

The chapters in this textbook are well-organized and up-to-date. The organization of the chapters would make updating or adding features without adding clutter relatively easy.

This was the most clear MATLAB textbook that I found for an introductory course. The textbook combined a nice balance of technical programming language with detailed explanations and summaries in language accessible to a first-time programmer.

This textbook is consistent in terminology and organization. Each chapter follows a similar format and is easy to follow.

Each section does not have large blocks of text. Rather, the text provides a nice balance of example scripts and code with explanations and reasoning behind each method. My students seemed to find the mid-text examples a beneficial addition to each section. No one section was too lengthy. Easy to follow and well-labeled.

I found the lack of plotting methods to be the biggest downfall of this text. I ended up including my own section on plotting capabilities. All included sections were very thorough and easy to follow.

The textbook is free of significant interface issues. The online version is very easy to navigate with direct links to chapters. There are minimal image distortions.

I did not find any grammatical errors in the text.

This text is not culturally insensitive or offensive in any way. There were not any examples that I came across that have any racial or ethnic background references.

This textbook was very easy to follow for my students in an introductory MATLAB course. I would have liked to see a section on plotting capabilities, but other than that, it was a wonderful text!

I currently teach a sophomore-level introduction to MATLAB and numerical methods course for chemical engineers. This text is perfect, and I plan to use it in place of a traditional textbook. MathWorks has a large number of very good MATLAB... read more

I currently teach a sophomore-level introduction to MATLAB and numerical methods course for chemical engineers. This text is perfect, and I plan to use it in place of a traditional textbook. MathWorks has a large number of very good MATLAB resources available online, which range from readings, to video tutorials, and example files. While these resources are excellent, I still find a I need a course text guide the student (who is new to MATLAB) through the course. For this purpose, the text is an excellent fit. It contains just the right amount of detail and is structured perfectly for my course. The basic coverage is exactly what I would hope to cover in 1 semester. The text assumes knowledge of calculus plus differential equations, with no programming experience, which is perfect for my class. Where the text is lacking, which I actually think is a good thing, is on the examples and end of chapter problems. I say this is good, because it is something the instructor can readily create and use as a opportunity to customize the text for their field of study. Likewise, compared to other MATLAB texts I have used in the past, it lacks mathematical content. Again, I think this is a good thing. The author assumes knowledge of calculus and differential equations. (Both are pre-requisites for my course.) If the student needs review or help in these areas, they can refer to their course notes/text book, and I can help fill in gaps during class and recitation. But by omitting this material from the text, it becomes a much better resource for my students that like to quickly read through the material.

Great! The material is current and up-to-date. I would also add that the text would also be appropriate to introduce students to GNU Octave (an open-source MATLAB alternative). This has happened to me while teaching abroad.

The text is currently up to date, and I believe it is written in a way that it can easily be maintained for many years to come. The only material that can become outdated are the examples (and example i/o). By teaching and working through the book, any problems can readily be identified and fixed as needed.

The text is very clear. The author writes very informally, which I appreciate. I feel as if I am being taught by a friend at just the right level.

Yes, the text is very consistent. At the end of each chapter, the author summarizes the new vocabulary terms from the chapter. This builds through the book. The text reads very smoothly.

The text is very well structure for a course of study. The chapters, and text as a whole, are a very nice length. They allow the students to spend less time reading and more time doing. In terms of modularity, for my course I would work through the text as is. My students have no prior MATLAB or programming experience. With a more advance background, the some of the earlier chapters could be skipped.

Great! For a student new to MATLAB and programming, the pace and structure is great.

Great! The website provides a PDF and an online version, in addition to a link to purchase a printed copy on Amazon. When I download the provided PDF it is not hyperlinked. However, the LaTex source is also available and allows for customization and hyperlinking, and you can even create a version for an e-reader. This additionally allows one to created a customized version for their course.

The book is well written, and the author has done a great job editing.

The text is not culturally insensitive or offensive in any way. It is a math/science book, so I do not believe this is relevant.

Great text! I would also comment that the author has written many other very good, non-open source computer science texts. The availability of this text at no cost is absolutely wonderful.

Physical Modeling for MATLAB is a text book that would provide a great reference text book for our Electrical Circuits series courses (three courses) where MATLAB is used in the laboratory portion of the course. The text provides all the areas of... read more

Physical Modeling for MATLAB is a text book that would provide a great reference text book for our Electrical Circuits series courses (three courses) where MATLAB is used in the laboratory portion of the course. The text provides all the areas of subject matter as described in the table of contents from basic programming syntax, scripting, looping, plotting, to vectors, functions and higher order physical and engineering equations pertaining to real problem solving situations. The text shows several examples throughout the book on usage for the particular subject matter in each chapter. Examples are helpful for both the instructor and students as the explore the different function and code samples. Each example provides strong explanations on how the code works. This text would be a great text for the elrctrical cicuits courses and I plan to utilize them in an upcoming course.

The information in the text is highly accurate to provide necessary information on code usage and code explanations. The text also has a list of errata giving credit to othre people who found issues or errors in the text.

The text is advanced in nature containing the most up to date information for the use of MATLAB. The text is only two years old, so the material is up to date.

The text is written in higher level terms which is particularly useful for the targeted audience for this text. The text is clear in its statements and show by example approach.

The text follows a consistent pattern for each chapter and an overall framework for the text. Each chapter topic is defined and then provided with syntax explanations, examples, usage, and related information necessary to follow along the topic.

Th text is broken down by MATLAB topics making it asy for the student to relate. Within each chapter, a definition of the topic is created followed by an explanation of the topic code usage and examples.

this text is definitely written in a clear logical fashipn starting with simple code blocks and builds to more complex structures.

the interface to this text is concise and easy to follow

The grammar in this text is correct and written with the student in mind.

There is no cultural sensitivity for this text. As a technical text it is written universally with the whole idea of making the information in its own understand by everyone.

I plan to use this text next year for the Electrical Circuits Series courses at Portland Community College. This will enable to students to focus on what is important in particular with the laboratory experiments as to what code and approach to use.

## Table of Contents

- 1 Variables and Values
- 2 Scripts
- 3 Loops
- 4 Vectors
- 5 Functions
- 6 Zero-finding
- 7 Functions of vectors
- 8 Ordinary Differential Equations
- 9 Systems of ODEs
- 10 Second-order systems
- 11 Optimization and Interpolation
- 12 Vectors as vectors

## About the Book

Most books that use MATLAB are aimed at readers who know how to program. This book is for people who have never programmed before. As a result, the order of presentation is unusual. The book starts with scalar values and works up to vectors and matrices very gradually. This approach is good for beginning programmers, because it is hard to understand composite objects until you understand basic programming semantics. But there are problems:

- The MATLAB documentation is written in terms of matrices, and so are the error messages. To mitigate this problem, the book explains the necessary vocabulary early and deciphers some of the messages that beginners find confusing.
- Many of the examples in the first half of the book are non-standard MATLAB. I address this problem in the second half by translating the examples into a more idiomatic style.

The book puts a lot of emphasis on functions, in part because they are an important tool for controlling program complexity, and also because they are useful for working with MATLAB tools like fzero and ode45. I assume that readers know calculus, differential equations, and physics, but not linear algebra. I explain the math as I go along, but the descriptions might not be enough for someone who hasn't seen the material before. There are small exercises within each chapter, and a few larger exercises at the end of some chapters.

## About the Contributors

### Author

**Allen Downey** is an American computer scientist, Professor of Computer Science at the Franklin W. Olin College of Engineering and writer of free textbooks. Downey received in 1989 his BS and in 1990 his MA, both in Civil Engineering from the Massachusetts Institute of Technology, and his PhD in Computer Science from the University of California at Berkeley in 1997. He started his career as Research Fellow in the San Diego Supercomputer Center in 1995. In 1997 he became Assistant Professor of Computer Science at Colby College, and in 2000 at Wellesley College. He was Research Fellow at Boston University in 2002 and Professor of Computer Science at the Franklin W. Olin College of Engineering since 2003. In 2009-2010 he was also Visiting Scientist at Google Inc.