Introduction to MATLAB

Yossi Farjoun

3D plot of a 2D sinc function
A 3D plot of a 2D sinc function. (Image by MIT OpenCourseWare.)

This course was offered as a non-credit program during the Independent Activities Period (IAP), which is a special 4-week term at MIT that runs from the first week of January until the end of the month.

The course, intended for students with no programming experience, provides the foundations of programming in MATLAB®. Variables, arrays, conditional statements, loops, functions, and plots are explained. At the end of the course, students should be able to use MATLAB in their own work, and be prepared to deepen their MATLAB programming skills and tackle other languages for computing, such as Java, C++, or Python.

The course mostly follows the official MATLAB Manual, available from The MathWorks. We will cover material from chapters 2-5.

Technical Requirements

MATLAB® software is required to run the .m files found on a course site. Additional toolbox plug-ins may also be required as noted on a course site. Any text editor can be used to view the contents of the .m files found on a course site.

Introduction to MATLAB contents


Lecture 1: Introduction to MATLAB Basics

  • Getting MATLAB to Run
  • Programming
  • The Command Prompt
  • Simple Expressions
  • Variables
  • Referencing Matrix Elements
Lecture 1 Notes and Exercises (HTML)

Lecture 2: Matrices

  • Accessing Matrix Elements
  • Assigning into Submatrices
Lecture 2 Notes and Exercises (HTML)

Lecture 3: Basic Tools

  • Matrix Concatenations
  • More Expressions
  • Plotting
  • Logical Constructs
  • Formatting Text
Lecture 3 Notes and Exercises (HTML)

Lecture 4: Flow Control

  • "if" Statement
  • "for" Loops
Lecture 4 Notes and Exercises (HTML)

Lecture 5: Defining Functions

  • "while" Statements
  • Variable Scope
Lecture 5 Notes and Exercises (HTML)

Lecture 6: Functions and Logic

  • Multiple Input Functions
  • More on Logic
Lecture 6 Notes and Exercises (HTML)

Questions and Answers

Students were given the opportunity to post questions. The instructor posted replies for the entire class to read. (HTML)

Introduction to MATLAB Project Ideas (PDF)

This is not a well-defined list of projects; they are mostly meant as starting points and ideas. You can take any of these projects and make of it as much or as little as you feel like. However, you came to learn a new skill, and practice makes perfect!

Other MATLAB Resources at MIT

Introduction to MATLAB, class materials that were originally developed for a hands-on training course offered by the Office of Educational Innovation and Technology (OEIT) at MIT.

MATLAB Information from course 18.06, Linear Algebra

MATLAB Tutorial from course 10.34, Numerical Methods Applied to Chemical Engineering

  • MATLAB Tutorial (PDF)
  • Chapter 1: Basic MATLAB Commands (PDF)
  • Chapter 2: Programming Structures (PDF)
  • Chapter 3: Basic Graphing Routines (PDF)
  • Chapter 4: Advanced Matrix Operations (PDF)
  • Chapter 5: File Input/Output (PDF)
  • Chapter 6: Writing and Calling Functions (PDF)
  • Chapter 7: Data Structures and Input Assertion (PDF)
  • Chapter 8: MATLAB Compiler (PDF)