A Daily Dose of MATLAB for College Freshmen

Frederik J Simons, Princeton University, Geosciences

Author Profile
Initial Publication Date: September 8, 2020 | Reviewed: April 13, 2021


Teaching College Freshmen as part of a research-oriented "Freshman Seminar" involves teaching students MATLAB -- from scratch to proficiency. Rather than sharing any (domain-)specific educational materials that involve instructors and students working through problems together in class or lab (which we do for our course, for about six two-hour sessions, before we depart into the field for more data collection), here, I share a specific test bank of questions that I developed for Cody/MATLAB Grader.

Under the motto "A MATLAB Question a Day", there are six sets of five questions. While the questions remain very simple, devising them required thought, and their implementation inside the MATLAB environment (following the evolving versions of the platform) was not painless.

Our experiences with students working through these questions were positive, and we found that our approach really did help them develop MATLAB proficiency over the course of six weeks. Overall, I heartily recommend to any instructor the approach of setting up simple auto-graded MATLAB test banks, as a useful self-guided supplement to an otherwise balanced diet of guided instruction. I would love it it The MathWorks themselves came up with many more of these little proficiency-building brainteasers, e.g. in the the MATLAB Mobile App. Then it could become a MatlApple-A-Day!

Used this activity? Share your experiences and modifications

Learning Goals

The goal is strictly limited to providing MATLAB programming skills. But nothing intricate -- rather, focused on the mental building blocks and ways of thinking required to become a MATLAB user capable of further learning by doing.

Context for Use

MATLAB novices, right after their completing the Onramp. In our case, College Freshmen with or without programming experience (in the former case, their prior experience is almost never with MATLAB). Self-guided activity, independent work, five minutes per work day for six weeks. This activity is easily ported to almost any introductory MATLAB course, since the educational goals are for the students to attain basic proficiency with the language.

Let me sketch the scene for the Freshman Seminar in whose context these exercises have been developed. In the 2020 COVID Edition of our class, we mailed every student a home-weather kit, including a Kestrel Drop sensor and a Brinno TLC120 time-Lapse camera. Before class starts, we instruct the students to start collecting weather data, and sky pictures, and also to log daily forecasts from a variety of sources (e.g. phone apps, websites). Hereby we get them into the habit of observing, record-keeping, and thinking about prediction in general.

In the first week, we show them a time-series plot that we made based on our own data collection. The example shows air temperature and rain accumulation measured by my home Kestrel Drop, as compared to the professional-grade measurements made by a Vaisala Weather Transmitter WXT520 installed on the roof of our Campus building. The following lab centers on teaching the students to make their own version of such a plot, using their own data collected at home.

In the second week, we give the students historical weather data products for their own hometown, obtained from MeteoBlue. Our goal is to have them understand the difference between weather and climate, and to give them the ability to place their locally observed short-term data in the larger context of a 30-year history. Since all of our students are under lockdown in their homes, this provides us with an opportunity to have them compare weather and climate between their various localities. We encourage them early to develop hypotheses about meteorological and climate questions. Will it rain more next month than this month? Is the relative humidity higher this month than it has been historically, this time of year? Why? What are relationships between the weather variables, which ones are primary, and which ones are derived? 

Armed with nothing more than a small data set, and some basic plotting tools the students quickly are able to develop hypothesis-driven data-tested lab reports, illustrated with figures that they themselves programmed using MATLAB.

The MATLAB grader exercises are our way of keeping the students engaged daily, not just while in class, not just while preparing the assignments, but rather as a fulfilling habit. While we did not do a formal study on the effectiveness of our methods, we have taught classes of this format for over ten years, and we have clearly seen the difference in student's ability and the speed with which they develop since our introduction of the MATLAB Grader One-a-Day problems.

Towards the end of six weeks we switch from time-series analysis to the analysis of images. Our working hypothesis is that cloud cover has something to do with the relationships between weather variables and their values themselves. Our objective is then to teach them how to turn time-tagged images into data on, e.g., cloud cover that can be used in conjunction with the meteorological  time-series data. We begin with the simple analysis of breaking down images into their RGB constituents, and studying the distributions of intensities and the possibilities of image segmentation using thresholds on the color channels in order to drive quantitative measures of cloud cover and cloud thickness.

Description and Teaching Materials

It's somewhat hard to share these materials, since the questions ultimately have to be input into the MATLAB Grader format. However, I have copied them into self-explanatory text files and so you can download them here: MATLAB_Grader.zip (Zip Archive 14kB Oct12 20). Moreover, I can make any interested instructor a "student" in my course, upon entering their email address, so that they themselves can experience the question bank as a student would, before deciding whether they will be useful as is for their own needs, or require any adaptation.

Teaching Notes and Tips

You'll want to pass your own questions on to others for testing, well before you go "live" -- such as fellow instructors, teaching assistants, or past students, as your students will find ways to surprise you with their answers, which will strongly influence how you will write the questions and devise a grading scheme for them. In our case, the in-question tests for "correctness" were not meant to give the students a "grade" but rather to help us figure out whether they were understanding the material and approaching the questions in the right way.

Yet, over the years that we fine-tuned the test bank, the students did continue to surprise us with ways of answering even simple questions in ways that we ourselves hadn't thought about. This knowledge strongly continues to influence our formulation of such problems (the prompts for the students) and their assessment (the in-Grader computational checks for the appropriate answer and its many alternatives).


So now that's easy! since MATLAB Grader does the "grading" per se. But check above under "Teaching Notes and Tips", since you'll need to decide what to do with that grading information. In our case, we gave "points" for successful completion only. We individually checked the students' answers in order to return to common pitfalls during the "regular" teaching and follow-up.

References and Resources




The below GitHub archives are part of a series (alpha, bravo, charlie, etc...) whereby oscar and zero contain the most educational-specific pieces of MATLAB code. Note that the libraries are cumulative: alpha is needed to run bravo, is needed to run charlie, etc... So you will want to collect them all and make them part of your MATLAB path.