layout | title | subtitle |
---|---|---|
slides |
Programming with MATLAB |
Motivation |
- Scientists are using computers to do amazing things, like
- predict the physics of aircraft,
- develop atomic and molecular models to better understand matter,
- simulate the motion of planets, stars and galaxies, and
- study the biological processes that form the building blocks of life.
-
But for every successful simulation of global climate, there are a dozen more groups struggling just to get their program to run.
-
Many of them tweak and tinker for months, or years, till their code does something more than produce zeros, or grind to a halt.
- All of this pain can be avoided by
- writing programs that are well-documented,
- properly reusing code in programs,
- automating tasks that are done often, and
- systematically finding and fixing bugs when they appear.
- The good news is that none of this is rocket science.
- Like callibrating an oscilloscope, or titrating a solution, they are skills that are quickly picked up, and become easier with practice
- ...and they will be the focus of today's lesson.
- We use MATLAB in our lesson because
- we have to use something for our lesson,
- it's well documented,
- it has a large user base among scientists in academia and the industry, and
- it has a large library of packages for performing diverse tasks.
- In today's lesson, we'll learn how to
- load, analyze and visualize data in MATLAB,
- get our program to repeat tasks by writing loops,
- get our programs to make decisions using conditionals,
- make our code reusable by writing scripts and functions,
- write programs that check themselves for bugs,
- ...and along the way, learn some good programming practices, that will save us plenty of time, sweat and tears in the long run.