Download Chapter 2: SCRIPTS
MATLAB, a matrix-based language that’s popular with scientists and engineers, is surprisingly easy to learn and offers the perfect programming environment for modeling and simulating physical systems. This book is for those who are interested in these processes but have no programming experience. You’ll build up basic coding skills – useful in any high-level language – as you model systems like world population growth, infectious disease, bungee jumping, baseball trajectories, celestial mechanics, and more.
Curating the most useful and powerful subset of MATLAB, with the least amount of math, bestselling author Allen Downey cuts through the complexities and gets right to the good stuff. Once you master loops, vectors and functions, you’ll use differential equations to simulate the interactions of predator and prey species, then plot the results. As you progress, you’ll create multidimensional arrays to simulate projectiles, add new forces to your growing toolkit, and explore ways to visualize results.
Along the way, you’ll learn:
- The modeling process and framework, including selection, analysis, and validation
- How to use MATLAB scripts (program files), variables, values, and assignment statements
- Program development processes like incremental development, encapsulation and generalization
- How to use differential equations to describe Newtonian motion, simulate falling objects, and solve the “Penny Drop Myth”
- Spatial vectors for representing multidimensional quantities that simulate projectiles, such as human cannonballs
- How to model spring forces and gravitation, and simulate bungee cords and the orbit of the Earth around the Sun
Physical Modeling with MATLAB gives you programming skills for experimenting with fascinating problems, and empowers you to create solution models for a wide range of physical systems.