Beginning Matlab Course with TCLab
Welcome to this introductory course on MATLAB! This course is intended to help you start programming in MATLAB from little or no prior experience. There are video tutorials for each exercise if you have questions along the way. One of the unique things about this course is that you work on basic elements to help you with a temperature control project. You will see your MATLAB code have a real effect by adjusting heaters to maintain a target temperature, just like a thermostat in a home or office.
One of the best ways to start or review a programming language is to work on a simple project. These exercises are designed to teach basic MATLAB programming skills to help you design a temperature controller. Temperature control is found in many applications such as home or office HVAC, manufacturing processes, transportation, and life sciences. Even our bodies regulate temperature to a specific set point. This project is to regulate the temperature of the TCLab. Each TCLab has thermochromic (changes color with temperature) paint that turns from black to purple when the temperature reaches the target temperature of 37°C (99°F).
Final Project: Program the TCLab to maintain the temperature at 37°C. Display the heater level with an LED indicator as the program is adjusting the temperature. Create a plot of the temperature and heater values over a 10 minute evaluation period.
To make the problem more concrete, suppose that you are designing a chicken egg incubator. Temperature, humidity, and egg rotation are all important to help the chicks develop. For this exercise, you will only focus on temperature control by adjusting the heater.
Topics
There are 12 lessons to help you with the objective of designing the temperature control for the incubator. The 12 lessons can be completed with Jupyter notebooks or with Matlab Live Scripts. There is a MATLAB YouTube playlist to provide help with each lesson.
Jupyter Notebook with Matlab or Octave
The first thing that you will need is to install the required software to open and run the Jupyter notebook files. Any MATLAB-like distribution or Integrated Development Environment (IDE) can be used (MATLAB or GNU Octave) but the Jupyter notebooks (.ipynb
) must be run with an editor such as Jupyter lab, Jupyter notebook, or VS Code. The IPython notebook (.ipynb
) files can be downloaded at this link. Don’t forget to unzip the folder (extract the archive) and copy it to a convenient location before starting.
Matlab Live Scripts
Matlab users can access the live_scripts that have the same content as the Jupyter notebooks but run natively in Matlab starting with version 2018. This new feature of Matlab is like the Jupyter notebook in providing rich content with cells that run the Matlab code. Jupyter notebooks are recommended for those who have an older version of Matlab.
Learning Module | Matlab | Octave |
---|---|---|
Intro | Introduction | Introduction |
1 | Overview | Overview |
2 | Debugging | Debugging |
3 | Variables | Variables |
4 | Printing | Printing |
5 | Arduino | Arduino |
6 | Functions | Functions |
7 | Loops | Loops |
8 | Input | Input |
9 | If Statements | If Statements |
10 | Arrays | Arrays |
11 | Cell Arrays | Cell Arrays |
12 | Plotting | Plotting |
Get TCLab
You will need a TCLab kit to complete the exercises and they are available for purchase on Amazon.
Install Jupyter Notebook with Matlab or Octave Kernels
There are additional instructions on how to install MATLAB or install Octave. You will also need the Matlab kernel or Octave kernel for Jupyter. You can install the kernels with:
pip install octave-kernel
pip install matlab-kernel
Support
We would love to hear any feedback or problems you would like to send us! We are always trying to improve this course and would like to hear about your experience. We can be contacted at support@apmonitor.com.
Additional Resources