Technical Articles and Newsletters

Teaching Computer Programming to Students Everywhere with MATLAB and a MOOC

By Mike Fitzpatrick and Ákos Lédeczi, Vanderbilt University

A few years ago, we wrote an article entitled, “Teaching Computer Programming to First-Year Engineering Students with MATLAB and an eBook”, which told the story of CS 103, our introductory programming course at Vanderbilt University. That course, now renumbered CS 1103, has since doubled in size. Its popularity continues to grow as more and more students recognize that programming is an essential job skill.

Based on the success of our course at Vanderbilt, we decided to make the material freely available to everyone by creating a Massive Open Online Course (MOOC). We named our MOOC Introduction to Programming with MATLAB. While we expected it to reach a larger audience than the 300 Vanderbilt students who enroll each year, the number participating in the MOOC has surpassed our wildest expectations. 

In the three sessions offered in the first year, more than 80,000 enrolled students viewed lectures more than two million times and submitted more than 100,000 problem sets for grading. Of the enrolled students, the number who completed the course by achieving a passing grade on the problem sets is approximately twice the total number who completed our course at Vanderbilt during the past 15 years. According to Class Central, a curator for MOOC listings and student reviews, Introduction to Programming with MATLAB ranked second on its list of best online courses in 2015, and at the time of writing, ranks fifth among the 6,000 MOOCs ever rated on the site.  

Why Teach Computer Programming with MATLAB?

Introduction to Programming with MATLAB is an introductory, college-level course that teaches students how to apply the principles, vocabulary, and constructs of computer science to solve science and engineering problems with MATLAB®.

Many MOOCs that cover introductory programming use general-purpose languages such as C++, Java®, and Python®. We decided to use MATLAB because it is versatile and easy to learn. In addition, the design of the language makes it possible to write a powerful program in a few lines (Figure 1). While the problems may be relatively complex, the MATLAB programs that solve them are much simpler than the equivalent program written in a general-purpose language. Last but not least, MATLAB is used in a wide variety of domains, including the natural sciences and finance, as well as engineering, and it is heavily used in industry. Many of the students are attracted to our MOOC simply because it uses MATLAB.

Figure 1.  A video lecture on plotting in MATLAB that demonstrates how to create a 3D plot of a helix with just two lines of MATLAB code.

Creating Video Lectures

The course offered over 40 video lectures covering matrices and operators, functions, plotting and debugging, selection (conditional statements), loops, data types, and file input/output. Depending on the topic, lectures ranged in length from a few minutes to almost an hour. In those lectures we encouraged students to consult the eBook on which we based the MOOC, and we stressed that students learn programming best by doing rather than watching. Nevertheless, we spent a considerable amount of time producing the videos because we wanted the lectures to be as engaging and informative as possible.

We relied heavily on our years of experience in teaching this material in the classroom to overcome the challenges that all educators face when creating instructional videos: namely, we don’t know our audience, we can’t observe their reactions as we teach, and we receive no immediate feedback during the lecture. In addition, we had to account for the diversity of our target audience, which included not only college students but also secondary school students and college graduates.

In the videos we worked through the course material slowly and presented ideas as clearly as possible (Figure 2). We also included humor, hoping to add life to the lectures. This turned out to be challenging in its own right: it takes courage to tell jokes into a camera in a silent studio when you have no idea whether the audience will be laughing. Thankfully, the feedback was uniformly positive on this score. These comments are typical: “I love his sense of humor.” “He is funny, too, and keeps you quite engaged.” “The instructor uses humor, which keeps me smiling and enjoying the course!” At least they were smiling!

Figure 2.  Professor Fitzpatrick delivering a video lecture on data types in MATLAB.

In fact, the videos were well received overall by the students. One, who summarized common themes from many students, said this: “I appreciate how clean, smooth, and professional the videos looked, and am very grateful that your explanations were very thorough and clear…Every video had an 'a-ha moment' for me. As a-ha moments are few and far between for scientists, this was a big deal for me.” 

Developing Assignments and an Automated Grader

Each series of video lectures on a particular topic was followed by a graded assignment. There were six assignments altogether, each with eight problems that the students had to solve by writing a MATLAB program. The assignments became more challenging as the course progressed. In the last set, for example, students were asked to write one function that converts Roman numerals to Arabic numbers and another that computes bowling scores.

We realized early on that with thousands of students submitting tens of thousands of problem sets, it would be impossible to grade all the assignments manually. To address this challenge, we developed an automated grader in MATLAB that provides immediate feedback once the student is ready to test a completed assignment. Assignments can be completed directly in MATLAB or via a web browser using MATLAB Online. For each assignment, the student writes a MATLAB function to solve a problem.  

After developing the functions in MATLAB, the student checks each one with the automated grader, which examines the function’s outputs for a series of inputs. In addition to testing the functionality of the student’s solution, the grader also ensures that the student followed certain restrictions in programming their solution. For example, on a logical indexing assignment we did not allow the use of for or while loops. The grader scans the submitted code to enforce these rules.

Like the student feedback on the video lectures, response to the assignments and the grading system has been uniformly positive. As one student put it, “The assignments very nicely tested one's understanding of the subject.” Another commented, “Assignments [are] the best part of this course. The assignments are detailed, precise, and challenging enough to impress yourself.”

Since early 2016, Dr. Fitzpatrick and Dr. Ledeczi have adopted MATLAB Online as the platform for their MOOC.

“I love MATLAB Online,” says Dr. Fitzpatrick. “It’s the most exciting addition I’ve seen since I started using MATLAB twenty-five years ago. It provides me with the same powerful functionality that I have come to rely on for my research work, and the students in our MOOC can get that same functionality almost instantly. All you need is a web browser and a login, and in less than a minute, you can be cloud computing with the latest version of MATLAB.”

Building an Online Community

The final key factor in the MOOC’s success was the online community of students and volunteers that came together as the course progressed. The Coursera forum for our MOOC hosted animated discussions about the lecture material and problem sets. A trio of community teaching assistants (known as mentors on Coursera) took it upon themselves to answer student questions at all hours of the day, and volunteered to help test and refine the automated grader. The busiest mentors contributed more than 1000 posts each on the forums. Two MathWorks engineers also checked the forums regularly and answered questions on MATLAB installation and use of the MATLAB environment.   

We checked the forums daily but often found that all the students’ questions for that day had already been answered by a fellow student, a mentor, or a MathWorks engineer. We were simply astonished at the responsiveness, patience, and generosity of this online community. 

Next Steps

We are currently running the MOOC for its second consecutive year. We have updated some of the lectures and developed an entirely new set of assignments. Several students who completed the course last year told us they were taking the course again this year because they wanted the challenge and fun of working on the new problem sets.

After having so many students tell us how happy they are with the way this MOOC has helped them to fulfill their goals, and after noting that our MOOC was a close second to the #1 MOOC in 2015, A Life of Happiness and Fulfillment, we are tempted to make one last modification to our course: changing its name to Happiness and Fulfillment Programming with MATLAB! 


We would like to thank our dedicated and tireless course mentors, Brandon Armstrong, Kate Brady, Lee Lafferty, Aatish Kumar, Réal Labrie, Paul Mielke, and Matt Tearle. We are grateful to MathWorks for providing student licenses and financial support, and to the Vanderbilt Institute for Digital Learning (VIDL) for video production and other logistical help.

About the Author

Mike Fitzpatrick is a professor emeritus of computer science at Vanderbilt University. He retired in 2011 after teaching at the college level for 35 years, teaching computer science for 29 years, and teaching computer programming with MATLAB for 11 years. He holds a B.S. in physics and an M.S. in computer science from the University of North Carolina at Chapel Hill and a Ph.D. in physics from The Florida State University. He has used MATLAB in his research in computer-assisted surgery for over 20 years.

Ákos Lédeczi is a professor of computer engineering and the director of graduate studies in computer science at Vanderbilt University, where he has been teaching computer programming with MATLAB for eight years. He holds an M.S. in electrical engineering from the Technical University of Budapest and a Ph.D. in electrical engineering from Vanderbilt University. His research interests include model-integrated computing and wireless sensor networks.

Published 2016 - 93056v00

View Articles for Related Capabilities