An interactive MATLAB tutorial

This semester I am going to teach optimisation methods at the Technical University of Cluj-Napoca. As there are pretty calculation intensive methods that we use for optimisation, we obviously need use a mathematical package. For better or for worse, Universities these days are pretty much tided to proprietary software solutions and more specifically to the infamous MATLAB. So our first task for the semester is to make sure students know how to work with MATLAB.

Since many of the students know already MATLAB, and I really hate to make students bored with stuff they already know, I decided to make the first course a little bit more fun and interesting: I decided to write a small interactive tutorial for MATLAB. I made sure that such a thing did not exist (although one can never be sure) and started designing.

The specifications of the projects were simple:

  • Teach basic functionality of MATLAB to students, by asking them to perform tasks using MATLAB syntax and commands
  • Save their progress for later use
  • Make it easy for the TA to insert new questions

After some discussions with the other TA and the professor, I had the first prototype done in a few hours. It was a basic engine that allows to:

  • Print a short introduction for each question
  • Print a question and wait for input from the keyboard
  • Run some pre-evaluation commands for preparing the workspace
  • Evaluate whether the answer provided by the user is correct
  • Run post-evaluation commands for cleaning up

To make it as easy as possible to expand the set of questions, I decided to use a YAML file as input. Each question has several fields and everything can be inserted as plain text. The yaml file is later converted into a .mat file, so that the student does not have easy access to the evaluation code for each question.

I tried it already to two groups of students yesterday and they really enjoyed it. I also enjoyed it a lot as it allowed me to keep everyone busy and focus on the students that didn’t know even the basic MATLAB, while the more experienced students were progressing on the tutorial. The feedback was very good and they even made some suggestions on how the tutorial could be improved.

If you would be interested in using this in your class, you can find the code on github. There is some documentation on how to use and insert new questions, so please feel free to try it. I am planning on inserting more questions the following days/week, and I would love to hear if you have any ideas on what to include. Also other feedback is more than welcome!

comments powered by Disqus