This site is aimed at math and physics majors who may have little programming experience, but who want to learn techniques in computational physics. It contains examples pulled from a variety of fields in math, physics and astronomy. The examples are meant to supplement existing tutorials such as the excellent one put together by Spencer and Ware at BYU. It may be downloaded in pdf form from their website here.
Loops and If Statements
Reading Data Files
|A11||Read in data from an ASCII file||load(), textread()|
Download all Programing Basics Examples A00.m–A11.m here.
Download all 2D Plot Examples plot01.m–plot10.m here.
- Super Simple Plot – Simple plot of y=x^2. Examples of marker and line types.
- Playing With Axes – Controling the appearance and scaling of axes. Also log and semilog plots.
- Plotting a Circle
Solving Ordinary Differential Equations (ODEs)
1D First-Order ODEs
1D Second-Order ODEs
2D Second-Order ODEs
Circular, Restricted Three-Body Problem