SIO 209 Introduction to MATLAB (section 57889), Fall 2021 (1 unit S/U)
syllabus & course information
Instructor: Sarah Giddings, sgiddings at ucsd.edu
Class meetings ***NOTE that class instruction has been changed to remote, however students may still attend or work in person from the Eckart 225, computer lab, or from any other location of their choice: Mon 20 – Tues 21 Sept 08:30-13:00 (with breaks!)
Zoom lecture link: contact instructor or view through Canvas
Zoom office hours: 20 Sept 14:00-16:00, 21 Sept 14:00-16:00, or email me to set up an appointment
This course will provide a hands-on introduction to MATLAB. No prior experience is necessary. The course will cover variables, plotting, scripts, matrices and other ways to store data including NetCDF, loops, and an introduction to more advanced techniques. While the focus is MATLAB, a brief comparison to other programming languages will be included and several of the coding approaches and best practices are applicable to other languages. Course material including notes, homework, and .mat files will be posted here and on Canvas as the course progresses.
course schedule and links to materials:
* Monday September 20th
Workspace, startup, basic math, matrices & arrays, element-by-element vs. matrix math, symbolic algebra, characters & strings, scripts, best practices, basic plotting, saving figures, saving & loading data, loading and saving .txt or ascii files, basic statistics, basic fitting, MATLAB dates, figure properties, 2D plotting of 3D data, mapping, scatterplots
* Tuesday September 21st
indexing & logical, functions, loops, vectorizing code for efficiency, structures, cell arrays, Native MATLAB NetCDF, SNCtools NetCDF.
You do not need any background with MATLAB or computer programming. Programming is learned best by practice, so in order to follow along and do the homework, you will need to have access to a computer that runs MATLAB. Under current COVID-19 UCSD policy, this course format has been changed to remote instruction, however, students can still participate in person in the Eckart Computer lab if they choose. If you want to participate remotely but do not have access to a computer, please contact the instructor in advance so that we can discuss with the graduate division. UCSD has a campus-wide MATLAB license, instructions for students are here. Another option is to try the virtual lab. Worst case scenario, a student version is available at the UCSD bookstore ($100), but that should not be necessary.
** Before coming to class on the first day:
- download MATLAB and test that it works
- download notes for the first day of class
- download files provided
What if I have more or less experience than my classmates?
It is important to note that because this course is open to all levels, the level of difficulty will vary by student. In order to make the course valuable for a variety of experience levels, two sets of homework aimed for different levels (no prior experience and some-moderate experience) will be available as well as extensive office hours. I strongly encourage students to ask questions during class, slow me down if need be, and repeat some of the coding at home. Finally, a variety of references and tutorials are listed below including some free on-line learning tutorials for a range of experience levels.
note on the short format:
This class is scheduled for the very start of the fall quarter as some students may need to use MATLAB starting early in their fall quarter classes. Unfortunately, because of other competing time constraints (new student orientation, the Scripps Student Symposium, etc.), the course is packed into just 2 days this year. Prior offerings have been 2-3 days. While 4-5 days would be far preferable, most students find this course provides a good starting point. The goal is NOT to master the MATLAB programming language but rather to introduce students to the wide range of its capabilities and programming in general. For students with little to no experience, the main goal is to make them comfortable using the tool and knowing where to look for help in the future. For more experienced students, the goal is to learn some tricks and best practices.
credit & homework:
To enroll in the class, search for the section ID #57889 here. **You can only take this class credit/no credit, so please make sure you are appropriately enrolled.** To get course credit, you must attend both days of class and complete the homework. Homework will not be graded, it will be self-check. Again, you learn programming best by doing!
unusual circumstances for Fall 2021:
Please see the syllabus for more information on our circumstances for Fall 2021 and in-person learning. More will be included here as the Fall quarter start date approaches. Importantly, instruction has been switched to remote. Students may participate either remotely or via the classroom (still logging into the lecture via a computer). For students choosing to go to the classroom, a mask is required and students must follow UCSD other protocols including the vaccine mandate and daily symptom screening.
There are many textbooks covering MATLAB, so you might check out the selection at the UCSD bookstore. Here are a couple of suggestions:
- MATLAB, Third Edition: A Practical Introduction to Programming and Problem Solving by Stormy Attaway (bookstore link) (Amazon link). This one is well reviewed and recent.
- Physical Oceanography: A Mathematical Introduction with MATLAB by Reza Malek-Madani (Amazon link). This book seems useful for those interested in using MATLAB to solve numerical problems in physical oceanography. For those of you in different fields, look on-line, there are great books for applications to engineering, numerical methods, biology, etc.
- Introduction to Programming with MATLAB for Scientists and Engineers, second edition, by William W. Broenkow
- Mathworks (the company who developed MATLAB) has online tutorials as well as a detailed users manual is available.
- Regular Google searches work pretty well too as there is a very large user community and on-line responses to questions as well as application specific code sharing. Some code you will find through individual websites (e.g., TEOS-10) others you can find on the Matlab code file exchange.
Matlab help files (online and offline)
All of the Matlab help files are available within the program and online help. For functions, (e.g. the “plot” function), you can use the help command: >>help plot OR >>doc plot.