Information
- Instructor:
- Maxim Trokhimtchouk
- Section Hours:
- Section 14: M2-3 W4-5 F2-3, Section 15: TTh4-5:30
- Location:
- The computer labs in Evans Hall
- Office Hours: M4-5
- To be determined
- Prerequisites:
- none
- Text:
- Introduction to MATLAB® Programming, by Jonathan H. Dorfman, Decagon Press 2007
- CCN:
- Section 14: 54416, Section 15: 54419
Outline
This course is intended as an introduction to programming and programming concepts using MATLAB. It not only focuses on the use of MATLAB itself, but also introduces students to the fundamentals of programming, with emphasis on techniques and style. We will learn how to use MATLAB to implement and debug a complex program and how to use facilities such as MATLAB Help and other resources. We will also learn how to use MATLAB to produce plots and graphics, which are essential for presenting numerical computations. This course is recommended even for those who had prior programming experience, however, prior knowledge of programming if not necessary.
Details
The duration of the course is 5 weeks. To be precise, it is 15 hours of section time. The first class for both sections is on the week of January 26th.
This course is one unit, and graded on pass/not pass basis.
There will be no quizzes and no exams. Grade will be decided based on homework assignments. There will be 5 of them. In order to receive a passing grade a student must complete 4 out of 5 assignments.
The topics I expect to cover are:
- programming basics, especially operations on arrays
- program organization, especially functions and globals
- input and output, especially plotting
- debugging techniques
Scheduling
Section 14 meets on M2-3W4-5F2-3. Section 15 meets on TTh4-5:30.
Textbook
The textbook for this course is Introduction to MATLAB® Programming, by Jonathan H. Dorfman, Decagon Press 2007. You can purchase the book in Cal Student Store or in Ned's Bookstore.
Homework assignments
There will be 5 homework assignments. In order to receive a passing grade a student must complete 4 out of 5 assignments.
You can find the list of all, except the first, assignments bellow:
Matlab Information
Some (of the endless) online resources for Matlab
- Matlab Primer by Kermit Sigmon
- Tutorial from Mathworks
- Tutorial from Univ. Central Florida (last 14 chapters of engineering class)
- Tutorial from MIT
- Tutorial from Univ. Florida
- Links
- More Links
Notes and code examples
The notes for the fourth week are now online.
You can download an example of an implementation of Newtonian algorithm NewtonAlg.m. You can also download an advanced example spharm.m, which used GUI to display spherical harmonics.
Detailed outline of the course
Matlab programming 5 week crash course
- Brief introduction to MATLAB
- Introduction to general user interface
- Finding your way around
- Using Command-Window as an advanced calculator
- Manually iterating Newton algorithm
- Manipulating files
- Writing a small program in Edit window
- Executing a small program
- Using Help
- Writing a simple program
- Using arrays for storage
- More array initialization
- Elementary operations with arrays
- Rewriting elementary program using arrays
- Displaying output. fprintf and sprintf commands.
- Boolean expressions and conditional statements
- if...else...end statement
- if...elseif...else...end statement
- Boolean expressions involving arrays
- More control: while-loops
- More control: for-loop.
- Debugging
- Advance use of arrays in MATLAB
- Advanced array initialization
- More array operations
- Matrix algebra
- \ and / operators
- Accessing array elements
- Accessing matrix elements
- Advance example of the use of arrays
- Calendar Example
- Plotting in two and three space
- plot command
- Plot options and parameters
- legend command
- axis and grid plot example
- plot3 command
- mesh and surf commands
- Graphic objects
- Manipulating objects
- Functions and function handles
- Introduction to functions
- Passing arguments values
- More passing and returning values
- Implementing a small program as a function
- Calling functions indirectly using handles
- Creating and using function handles
- Creating and using anonymous functions
- Writing a complex program
Files for download
- count.m
- FibonacciExample.m
- forloopExample.m
- ifelseExample.m
- ifexample.m
- invert.m
- logicarray.m
- NewtonAlg2.m
- NewtonAlg3.m
- NewtonAlg4.m
- NewtonAlg5.m
- NewtonAlg6.m
- NewtonAlg7.m
- whileExample.m
- countoutloud.m
- plotex.m
- plot3ex.m
- surfex.m
- plotcomplex.m
- calendar.m
- VectorNewton.m due to John Dorfman
Acknowledgement
I would like to aknowledge Jonathan Dorfman whose notes from his MATLAB course I used in preparing this site.