Cover of Physical Modeling in MATLAB

Physical Modeling in MATLAB: run the code online

by Allen B. Downey

Each chapter of the book is a notebook you can read and run in your browser. The code runs in GNU Octave, the free alternative to MATLAB, compiled to run in the browser: there is nothing to install and no account to create.

Chapters

Click a chapter to open it, then run each code cell in order with Shift+Enter. You can change the code and run it again. The first chapter you open downloads Octave, which can take a minute.

  1. Modeling and Simulation
  2. Scripts (solutions)
  3. Loops (solutions)
  4. Vectors (solutions)
  5. Functions (solutions)
  6. Conditionals (solutions)
  7. Zero-Finding (solutions)
  8. Functions of Vectors
  9. Ordinary Differential Equations (solutions)
  10. Systems of ODEs (solutions)
  11. Second-Order Systems (solutions)
  12. Two Dimensions
  13. Optimization (solutions)
  14. Springs and Things (solutions)
  15. Under the Hood

Your changes are saved in this browser only. To work with all the files, including each chapter's code, open the full workspace.

About the book

Physical Modeling in MATLAB is an introduction to programming and to modeling and simulation of physical systems, for people who have never programmed before. It assumes some calculus and basic physics.

The examples are written for MATLAB and also run in GNU Octave. Text: CC BY-NC 4.0; code: MIT License.