MATLAB Programming for Engineering and Science Students
Simon Mathias
Department of Engineering
Durham University
Citation: Mathias, S. A. (2023) MATLAB Programming for Engineering and Science Students. Durham University. https://samathiasuk.github.io/MATLABnotes/html/MATLABcontents.html
Contents
Session 1 - Arrays and plotting
- Input data into a 1D array.
 - Access data from a 1D array.
 - Distinguish between row and column vectors.
 - Determine the size of an array.
 - Input data into 2D arrays.
 - Access data from 2D arrays.
 - Write a script file.
 - Import data from an excel file.
 - Plot data in x-y scatter plots.
 
Session 2 - Loops and conditions
- Repeat operations using a "for" loop.
 - Define logical statements.
 - Compare arrays using logical statements.
 - Select data using logical statements.
 - Use sum, mean, std, max and min.
 
Session 3 - Using subfunctions
- Construct and interpret a cumulative distribution plot.
 - Rank data using sort.
 - Organise a script file using subfunctions.
 - Save and load data in mat files.
 
Session 4 - Approximate methods for differentiation and integration
- Describe how derivatives can be approximated using finite differences.
 - Approximate the derivative of a variable using diff.
 - Show how finite differences link with trapezoidal integration.
 - Approximate the integral of a variable using cumtrapz.
 
Session 5 - MATLAB's ODE solvers
- Solve an ordinary differential equation using first-order explicit time -stepping.
 - Re-cast the concept of first-order explicit time-stepping in terms of an ODE function.
 - Describe how ode45 works.
 - Solve an ordinary differntial equation using ode45.
 
Session 6 - Solving PDEs using ODE solvers
- Use a finite difference spatial discretisation to transform a partial differential equation (PDE) into a set of coupled ordinary differential equations (ODE).
 - Solve the one-dimensional advection dispersion equation using ode45 or ode15s.
 - Apply a non-uniform grid spacing.
 - Understand the meaning of stiff and non-stiff problems.
 - Determine the Jacobian pattern associated with a PDE problem.
 - Solve PDEs using ode15s.
 
