A Guide to MATLAB for Beginners and Experienced Users, Second Edition

In this chapter, we present examples showing you how to apply MATLAB to problems in several disciplines. Each example is presented in the form of a MATLAB M-file, published to LATEX. We modified the default style sheet for publishing to LATEX to adjust the spacing between input, output, and text, and to allow formatting of mathematical formulas not just as displayed equations but also within a paragraph. We also made a few minor adjustments to the published LATEX code to improve line breaks. Finally, because publish does not produce italic text, we used bold text instead in places. These examples are illustrations of the kinds of polished, integrated documents that you can create with MATLAB. The examples are:
Illuminating a Room
Mortgage Payments
Monte Carlo Simulation
Population Dynamics
Linear Economic Models
Linear Programming
The 360 Pendulum
Advanced Numerical Solution of the Heat Equation
Advanced A Model of Traffic Flow
We have not explained all the MATLAB commands that we use; you can learn about the new commands from the online help. Simulink is used in A Model of Traffic Flow and as an optional accessory in Population Dynamics and Numerical Solution of the Heat Equation. The example on Linear Programming also requires an M-file found (in slightly different forms) in the Simulink and Optimization toolboxes. The examples require different levels of mathematical background and expertise in other subjects. Illuminating a Room , Mortgage Payments, and Population Dynamics use only...