Improving Learning Outcomes in Civil Engineering with MATLAB Live Editor and a Flipped Classroom

By Dr. Robert Lang, University of Alaska

Four years ago, after decades of teaching civil engineering using a traditional, lecture-based approach, I decided to adopt a different model. I’d been concerned for some time that the traditional format turned students into passive learners. Even if I worked through problems in class, it did little more than demonstrate my ability to solve them. I wanted the students to be actively engaged with the material.

I was teaching two courses at the time: CE A462 Surface Water Dynamics, a senior-level course covering open channel flow theory, and CE A663 Ground Water Dynamics, a senior- and graduate-level course covering geohydrology fundamentals and flow hydraulics. Both courses met once a week from 5:30 to 8:30 PM to accommodate students who were also working professionals. Lecturing for three hours in the evening compounded the already considerable challenge of holding the students’ attention. 

I decided that the best way to turn my students into active learners would be to flip the classroom and work through classroom exercises using MATLAB® and MATLAB Live Editor. The switch was transformative. Students were more motivated and interested in the material, and learning outcomes improved sharply.

A Hybrid Teaching Model

The teaching model I adopted was actually a hybrid of flipped and traditional methods. I posted PowerPoint notes online for the students to review before class. That enabled me to quickly run through the lecture portion of each session and move on to exercises that reinforced the concepts introduced in the lecture. Students followed along in MATLAB on their own computers. The immediate feedback that Live Editor provides, such as contextual hints for function arguments, made it easy for students new to MATLAB to come up to speed and enabled me to solve problems in class unrehearsed. With Live Editor, students could see the results of their code. Plots and other visualizations, such as a graph showing the velocity distribution of flowing water, appeared alongside the code and updated automatically, making for a much more interesting, interactive classroom experience.

For the homework assignments, students had to provide not only their code but also a readable explanation of how they solved the problem. Live Editor made this straightforward: students were able to create live scripts that fully documented their code with formatted text, equations, and graphs (Figure 1), making their solutions self-explanatory and understandable by anybody in the field.

Figure 1. MATLAB live script, created by a student for a homework assignment. Top: Code calculating the kinetic energy correction coefficient α. Bottom: Plot of minimum specific energy for a rectangular channel.

Beyond Specialized Software and Textbooks

Many instructors incorporate specialized software into upper-level civil engineering courses. In a surface water dynamics course, for example, the instructor may use HEC-RAS software from the Army Corps of Engineers while teaching the hydraulics of water flow. While HEC-RAS is a powerful tool, it takes considerable time to learn.

MATLAB, in contrast, is easy to learn and can be used to solve a wide variety of problems. More importantly, MATLAB gives students insight into the numerical methods that the specialized software has implemented behind the scenes. To illustrate these points, I guided the students through solving a problem in HEC-RAS, to give them some familiarity with the tool should they need it when they graduated, and then had them solve the same problem in MATLAB.

The versatility of MATLAB enabled me to move beyond the textbook and its often outdated solutions and approaches. For example, in a scenario in which water is being pumped from an aquifer, engineers can infer the parameters of the aquifer by applying methods described in the textbook. While the methods are well-known, they are also arcane; they involve plotting on log paper and eyeballing the best fit. In my class, students invoked non-linear curve-fitting functions in MATLAB to quickly find the answer. 

Tackling More Advanced Problems

Some of the problems I wanted to use as class exercises were too complex for the students to complete from scratch. For example, in Surface Water Dynamics, I introduced the Saint-Venant shallow water equations, a set of coupled nonlinear hyperbolic partial differential equations. Analytic solutions to these equations are a significant challenge, and I did not want to spend class time explaining how to solve them. Instead, I created a live script with MATLAB that set up a sample problem and its solution. I had the students run the script as I provided it and then modify it to solve problems similar to the one I had solved.

In Ground Water Dynamics, most problems for water flow in aquifers also involve partial differential equations. In that class, rather than using custom software available from the United States Geological Survey, I had the students solve the equations themselves using MATLAB and Partial Differential Equation Toolbox™. For one assignment, students were given the dimensions of an aquifer and asked to determine how much water could be pumped out without pulling in water from a second aquifer or river. The students set up and integrated the necessary equations in MATLAB and then ran a variety of scenarios interactively, which gave them insight into how the equations worked. 

Introducing Field Work

For the midterm exam in Surface Water Dynamics, I took the students even further beyond the textbook by assigning field work. They had to visit the stream that flows through the University of Alaska campus and estimate the flow in the stream (for example in cubic meters per second). They then had to use MATLAB to size a channel (in any of the classic shapes used to represent the river cross-sections, such as trapezoid, circle, or parabola) to handle the flow they had estimated. I provided no numbers; I wanted the students to come up with their own so that they would develop a physical understanding of water flow.

Even for a midterm it was a challenging assignment, but I had a way to help students who were struggling. I developed a MATLAB app that performed all the calculations required in the assignment via a simple user interface that I created using App Designer (Figure 2).

Figure 2. MATLAB app for calculating open channel flow.

I first used the app to check the students’ work myself, and then gave them the app and its source code so that they could check their own work. If their solution was way off, they could explore the MATLAB source code to debug their code before resubmitting it. Despite the challenging nature of the assignment, the students enjoyed it greatly. Many were interested in how I created the UI.This group stayed after class to learn more about App Designer and used what they learned to make apps for other classes.

Improved Learning Outcomes

I had set out to engage students by having them solve problems in MATLAB rather than merely memorize and recite formulas. That shift in focus, combined with the flipped classroom model enabled by MATLAB and MATLAB Live Editor, led to a significant improvement in learning outcomes. Virtually 100% of the students I taught with this new approach demonstrated mastery of the material, compared to 70%-75% of students taught with a traditional approach in past years. In addition to mastering surface water dynamics and ground water dynamics, my students came away from the courses proficient in MATLAB and comfortable using it to solve civil engineering problems. Several students told me it was the best course they had ever taken, and students who were graduating told me that they had been hired specifically because of what they had learned in classes that I taught.

About the Author

Dr. Robert Lang is Professor Emeritus of Civil Engineering at the University of Alaska Anchorage and Professor Emeritus of Civil and Environmental Engineering at California Polytechnic State University, San Luis Obispo. He holds a Ph.D. in Civil and Environmental Engineering from the University of California at Davis. 

Published 2019


View Articles for Related Capabilities

View Articles for Related Industries