Technical Articles

Creating a Smartphone-Based Signals and Systems Laboratory for Undergraduate Engineering Students

By Nasser Kehtarnavaz, University of Texas at Dallas


All undergraduate electrical engineering students at the University of Texas at Dallas are required to take a course on signals and systems. We supplement this third-year course with a one-credit lab that gives students a chance to implement the concepts they learn in lecture.

For the past several years, I’ve taught 3102 Signals and Systems Laboratory with an emphasis on hands-on coding. Students complete assignments on convolution, Fourier series, Fourier transform, and other key signals and systems concepts by writing short MATLAB® programs. I recently added a new dimension to the lab: The students now use MATLAB Coder™ to generate C code from their MATLAB programs to enable the creation of mobile apps that they run on their Android™ or iPhone devices.

This approach enables students to complete lab work anytime and anywhere, and gives them first-hand experience with hardware constraints and practical implementation issues. It also adds interest to the course. In their assessments of the most recent Signals and Systems Laboratory, students reported that the use of smartphones increased their engagement with the material.

Taking Lab Work Out of the Lab

Few universities have a lab associated with signals and systems, and those that do often involve running MATLAB code on desktop computer platforms. Because of the limitation on the number of computer platforms in a lab room, lab time is tightly scheduled. Last semester alone, about 200 third-year electrical and biomedical engineering students enrolled in 3102 Signals and Systems Laboratory. Even after creating 10 sections, it is challenging to find lab time and space for that many students.

However, the processors in the mobile devices that students bring to class every day are more than powerful enough to run signal processing algorithms. By creating lab assignments that use the students’ own devices as the processing hardware, I have enabled students to experiment anywhere and at any time. The school’s Total Academic Headcount license, which provides students with campus-wide access to MATLAB on their own laptops, helped make this possible.

Creating a Framework for Signal Processing Mobile Apps

Before I could ask students with little programming experience to create mobile apps, I needed to give them a straightforward way to translate their MATLAB code into C code. I also needed a framework that they could use to run the C code on mobile devices.

I met the first requirement with MATLAB Coder, which enables students to generate efficient C code for their smartphones from MATLAB code that they develop and debug on their laptops. To meet the second requirement, I developed two programming shells that students can install on their mobile devices, one for iOS, written in Objective C, and one for Android, written in Java® (Figure 1).

Figure 1.  Diagram of programming shells used to run C algorithms on iPhone and Android devices.

Figure 1. Diagram of programming shells used to run C algorithms on iPhone and Android devices.

Introducing MATLAB and Basic Programming

Because few of the students enrolled in Signals and Systems Laboratory have experience with MATLAB or with computer programming, I begin the course with an introduction to programming principles in MATLAB. The students first learn basic programming concepts, including arithmetic and vector operations, array indexing, memory allocation, and control flow. I then cover the more advanced techniques that they will need to complete their assignments, including loading and saving data, reading wave files, and generating signals.

Over the following two weeks, the students practice generating C code with MATLAB Coder and compiling apps in the smartphone programming environment for their specific device. All the materials and assignments come from the book written for the lab course, Anywhere-Anytime Signals and Systems Laboratory: From MATLAB to Smartphones.

Developing Apps for Convolution, Fourier Series, and Fourier Transform

The first mobile app that the students develop is for a lab assignment on solving linear time-invariant (LTI) systems via the convolution integral. In this assignment, the LTI systems examined are RLC circuits. The students use MATLAB to perform a numeric approximation of the convolution integral and find the output voltage or current in response to a given input voltage or current. After developing and testing their solution in MATLAB, the students generate C code with MATLAB Coder. They then compile this C code along with the device-specific shells that I provide them to build an app for their mobile devices (Figure 2).

Figure 2.  Mobile app developed for lab on linear time-invariant systems and convolution.

Figure 2. Mobile app developed for lab on linear time-invariant systems and convolution.

Next, the students explore Fourier series summation and reconstruction of periodic signals. They learn that if they know the response of a linear circuit to one sinusoidal input signal, they can obtain the response to any periodic signal by decomposing it into sinusoidal signals and performing a linear superposition of the sinusoidal signals. As with the previous assignment, the students first develop an algorithm that demonstrates this principle in MATLAB and then use MATLAB Coder to implement that algorithm in C code for a mobile app (Figure 3).

Figure 3. Mobile app for the Fourier series lab.

Figure 3. Mobile app for the Fourier series lab.

In the remaining lab assignments, the students use this same process to build apps that demonstrate their ability to use Fourier transforms for noise cancellation and amplitude modulation and to perform analog-to-digital and digital-to-analog conversions via signal sampling, quantization, and reconstruction.

In creating the lab assignments, I wanted to challenge the students without overwhelming them. With students new to programming, it was important to keep the focus on applying signals and systems principles instead of working through complex programming exercises. For example, I allowed them to use the conv() and fft() functions in MATLAB rather than writing their own convolution and Fourier transform algorithms.

When I see the flash of recognition cross my students’ faces, I know that the approach has worked. Some students, for instance, question why they need to move to the frequency domain with a Fourier transform if they’ve already solved a system with convolution. When they see the problems they encounter as the frames get longer and longer and they can no longer use convolution, they see exactly why this is necessary.

With MATLAB Coder, I can provide hands-on activities that enable the students to experience and overcome the challenges that come with implementing actual solutions in the real world. In doing so, I achieve better outcomes and engagement from the students.

About the Author

Dr. Nasser Kehtarnavaz is an Erik Jonsson Distinguished Professor in the Department of Electrical and Computer Engineering at the University of Texas at Dallas. His research areas include signal and image processing, real-time implementation on embedded processors, biomedical signal and image analysis, and machine learning. He has authored or co-authored 10 books and more than 350 journal papers, conference papers, patents, manuals, and editorials in these areas.

Dr. Kehtarnavaz has pioneered and introduced several innovative approaches for students to learn the practical implementation aspects of signal processing concepts. Dr. Kehtarnavaz is a Fellow of IEEE, a Fellow of SPIE, a licensed Professional Engineer, and Editor-in-Chief of Journal of Real-Time Image Processing.

Published 2017 - 93161v00

View Articles for Related Capabilities