A Daily Dose of MATLAB for College Freshmen

Frederik J Simons, Princeton University, Geosciences

Author Profile

Summary

Teaching first-year college students, with my colleague Adam Maloof, 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 if 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!

Share your modifications and improvements to this activity through the Community Contribution Tool »

Learning Goals

The goal is strictly limited to providing MATLAB programming skills. But nothing intricate -- rather, focused on the mental building blocks and computational 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 non-traveling 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 taking 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, research-notebook record-keeping, and thinking about prediction in general.

In thefirst week, we show them a time-series plot that we made based on our own data collection. The example here 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 lab that follows 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 historical record. 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? How does my latitude, altitude, proximity to a large body of water, influence the diurnal cycle of weather variables, and the relationships between them? How far out can weather be predicted?

In the third week, armed with nothing more than a small data set, and some basic MATLAB plotting tools, 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 -- one a day, every day for six weeks -- 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 (who wants to deprive their students of the latest educational innovation as part of a double-blind study?), we have taught classes in this general format for over ten years, and we have clearly seen the difference in students' ability, and the speed with which they develop it, 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 the values themselves. Our objective is then to teach our students how to turn time-tagged images into data on, e.g., cloud cover, that can then 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. Towards the second half of the course, we introduce more sophisticated methods of image analysis and introduce notions of marine learning and other methods of computational and statistical inference.

Description and Teaching Materials

It's somewhat hard to share these materials, since the MATLAB Grader questions ultimately have to be input into the MATLAB Grader format on the website. However, I have copied them into self-explanatory text files 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 onto 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 creative 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 (who knew there is a function called pow2?). This knowledge strongly continues to influence our formulation of such problems (i.e., the prompts for the students) and their assessment (i.e., the in-Grader computational checks for the appropriate answer and its many alternatives).


Assessment

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 be able to return to common pitfalls during the "regular" teaching and subsequent follow-up.

References and Resources

https://grader.mathworks.com

https://www.mathworks.com/learn/tutorials/matlab-onramp.html

http://geoweb.princeton.edu/people/simons/FRS-CCCI.html

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.

https://github.com/csdms-contrib/slepian_zero
https://github.com/csdms-contrib/slepian_oscar

Some specific files that were used to make the images for this contribution are here:

https://github.com/csdms-contrib/slepian_zero/blob/master/brinno2mat.m
https://github.com/csdms-contrib/slepian_zero/blob/master/drop2mat.m
https://github.com/csdms-contrib/slepian_oscar/blob/master/guyotweather.m
https://github.com/csdms-contrib/slepian_zero/blob/master/meteoblue.m
https://github.com/csdms-contrib/slepian_zero/blob/master/meteobluf.m