9
Signal processing with Mathematica: active learning in the engineering classroom M. Jankowski Maine, Gorham, ME 04038, USA-e-mail: [email protected] Abstract In many of the foundational courses in the electrical engineering discipline, a student's lack of adequate mathematical skills is one of the primary barriers to effective learning, and ultimately, successful completion of degree requirements. To compound the problem, the courses are frequently taughtusing the traditional lecture format. In a number of electrical engineering courses, we have embarked on an experiment to improve learning and deepen understanding of the subject matter by: (i) facilitating active learning, (ii) breaking with the traditional lecture format and (iii) making mathematics more accessible to the students. Classes are held in a computer equipped classroom with on-line access to Mathematica. In these sessions, the traditional lecture is frequently replaced by an instructor supervised independent exploration of the subject matter by the student. Elec- tronic courseware based on Mathematica notebooks is under development and a package that extends Mathematical functionality in the area of digital image processing has been written. 1 Introduction Most electrical engineering courses, in particular those in the signals and sys- tems area, require an excellent grasp of the principles of mathematics. Founda- tional courses such as Circuits, Signals and Systems, Communications and Con- trol Theory present in a difficult mathematical framework, many important con- cepts: bandwidth, modulation, sampling, stability, and more. The coverage of these concepts in an undergraduate engineering curriculum presupposes a good grasp of differential equations, linear algebra and complex number theory in ad- dition to the standard calculus sequence. As is typical of most ABET-accredited Transactions on Engineering Sciences vol 15, © 1997 WIT Press, www.witpress.com, ISSN 1743-3533

274 Innovation In Mathematics - WIT Press · student's lack of adequate mathematical skills is one of the primary barriers to effective learning, and ultimately, successful completion

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 274 Innovation In Mathematics - WIT Press · student's lack of adequate mathematical skills is one of the primary barriers to effective learning, and ultimately, successful completion

Signal processing with Mathematica: active

learning in the engineering classroom

M. Jankowski

Maine, Gorham, ME 04038, US A-e-mail: [email protected]

Abstract

In many of the foundational courses in the electrical engineering discipline, astudent's lack of adequate mathematical skills is one of the primary barriers toeffective learning, and ultimately, successful completion of degree requirements.To compound the problem, the courses are frequently taught using the traditionallecture format. In a number of electrical engineering courses, we have embarkedon an experiment to improve learning and deepen understanding of the subjectmatter by: (i) facilitating active learning, (ii) breaking with the traditional lectureformat and (iii) making mathematics more accessible to the students. Classesare held in a computer equipped classroom with on-line access to Mathematica.In these sessions, the traditional lecture is frequently replaced by an instructorsupervised independent exploration of the subject matter by the student. Elec-tronic courseware based on Mathematica notebooks is under development anda package that extends Mathematical functionality in the area of digital imageprocessing has been written.

1 Introduction

Most electrical engineering courses, in particular those in the signals and sys-tems area, require an excellent grasp of the principles of mathematics. Founda-tional courses such as Circuits, Signals and Systems, Communications and Con-trol Theory present in a difficult mathematical framework, many important con-cepts: bandwidth, modulation, sampling, stability, and more. The coverage ofthese concepts in an undergraduate engineering curriculum presupposes a goodgrasp of differential equations, linear algebra and complex number theory in ad-dition to the standard calculus sequence. As is typical of most ABET-accredited

Transactions on Engineering Sciences vol 15, © 1997 WIT Press, www.witpress.com, ISSN 1743-3533

Page 2: 274 Innovation In Mathematics - WIT Press · student's lack of adequate mathematical skills is one of the primary barriers to effective learning, and ultimately, successful completion

274 Innovation In Mathematics

engineering programs, only differential equations is mandatory. Less than 50%of all electrical engineering (EE) programs require linear algebra and less than25% require complex variables (Doratofl]). Of course some topics in these sub-jects are taught within regular engineering courses; however, the student's com-mand of these topics is typically minimal. The part-time students, a large seg-ment of the student population at USM, are especially vulnerable, since skillsthey learn in mathematics may remain unused for extended periods of time, andtherefore forgotten. For many students, lack of physical insight and the diffi-culties with the level of mathematics are overwhelming and these courses remainunexplored, perceived as irrelevant and quickly forgotten.

The lack of adequate mathematical skills is further compounded by the tra-ditional lecture format. Much is already known about informal and formal class-room strategies that promote, active learning and break with the passivity of thetraditional lecture (Johnson, et. al.[2]). We have adopted a strategy of replacingthe typical "chalkboard" lecture with a closely supervised, interactive, hands-onexploration of the subject matter in a computer equipped classroom. This ap-proach forces the student to be an active participant in the lecture. Ultimately,the goal is to enhance understanding of fundamental theoretical concepts withinthe discipline. It is hoped that this can be achieved thanks to increased use ofcomputation and visualization.

It is well known however, that code development in high-level languagessuch as Fortran or C detracts from the desired goal of teaching the basic conceptsof the discipline. The significant programming effort required, leads frequentlyto disappointment and eventual loss of interest on the part of the student. At thesame time, the many interesting computational problems in introductory elec-trical engineering courses are an excellent vehicle for teaching fundamentals. Byintroducing the computer and a suitable computational tool into the classroom,the promise of an interesting and challenging hands-on learning experience is be-ing fulfilled. Theory and implementation reinforce each other helping to build adeeper understanding of the subject matter.

2 Pedagogical Objective and Evaluation

Integration of Mathematica into the electrical engineering curriculum at USM isdriven by a need to improve how our undergraduates learn basic concepts andskills central to their discipline. Two problems need to be addressed: inadequatelevel of mathematics skills on the part of the average student and student passiv-ity in a traditional classroom setting. We can simultaneously address both prob-lems by using Mathematica as the standard computational tool and by replacingmany of the typical "chalkboard" lectures with supervised, interactive, hands-onexploration of the subject matter in a computer equipped classroom. This ap-proach forces the student to be an active participant in the lecture and gives himthe needed tools to explore the subject matter beyond the few, typically simple,

Transactions on Engineering Sciences vol 15, © 1997 WIT Press, www.witpress.com, ISSN 1743-3533

Page 3: 274 Innovation In Mathematics - WIT Press · student's lack of adequate mathematical skills is one of the primary barriers to effective learning, and ultimately, successful completion

Innovation In Mathematics 275

examples found in standard texts. Mathematica serves both as an excellent pro-ductivity tool and an enabling technology that allows users to overcome the limit-ations of their math skills. As an added benefit, the use of a common tool acrossthe curriculum, is expected to be a powerful unifying factor in the educationalexperience of our students (Simonich and Peruse [3]).

Mathematica-based courses are presently taught using an alternating sequen-ce of traditional lecture periods and Mathematica-basQd problem solving ses-sions. Traditional lectures lay the theoretical foundations, while the laboratorysessions reveal implementation details and provide opportunities for visualiza-tion and testing. The two forms of instruction complement each other well. The-ory and implementation reinforce each otner building a deeper understanding ofthe subject matter. Each of the courses is supported by a number of Mathemat-ica notebooks covering the major topics of the discipline. The notebooks serveas interactive lectures and tutorials. At their best, they are prototypes for theelectronic textbooks of the future, interactive, animated and available via remotelinks. The notebooks are available online and can be viewed as static documentswith WWW browsers or downloaded and executed on computers running Math-ematica. They are composed of introductory and explanatory text, fully solvedexamples, a few questions and problems requiring student responses, and home-work assignments. Such notebooks fill an important pedagogical need by giv-ing the new Mathematica user many ready-to-use, working examples of typicalmathematical computations. The goal is to minimize the effort in learning thetool (i.e. Mathematica) versus learning the theoretical foundations of the area ofstudy (e.g. digital image processing). For the same reason, whenever possible,application-specific packages have been used to extend Mathematica's built-infunctionality. These typically allow mathematical computation to be presented ata high level of abstraction, making it easier to study important concepts withoutthe distraction of computer implementation details. Packages, with their high-level toolkit of application-specific functions, also benefit the experienced userby speeding the process of prototyping new solutions and writing notebooks.

An important component of the Mathematica-based courses are open-endedsignal processing group projects. Evaluation of project results is based on formaloral presentations. In the past, projects have included fast cosine and Hadam-ard transform implementations, the discrete wavelet transform, linear predictivecoding of voice and image data, block-DCT coding and wavelet coding of im-ages, design of a spectrogram package, Schur-Cohn stability test and linear filter-ing of real audio data. Many of these projects address important and interestingcomputational problems that bring together many of the topics discussed in thecourse of the semester. Projects place significant demands on students' Mathem-atica skills since they typically require substantial code development. It is expec-ted that difficulties associated with Mathematica programming will diminish asthe software gets introduced into a larger number of course.

Student evaluations of the courses, based on questionnaires and informaldiscussions, indicate guarded acceptance of the new format. There was strong

Transactions on Engineering Sciences vol 15, © 1997 WIT Press, www.witpress.com, ISSN 1743-3533

Page 4: 274 Innovation In Mathematics - WIT Press · student's lack of adequate mathematical skills is one of the primary barriers to effective learning, and ultimately, successful completion

276 Innovation In Mathematics

satisfaction with the ability to visualize signal phenomena and easily performtedious algebraic tasks, but also concern with the difficulty of learning Mathem-atica.

3 Implementation

Following several years of experimentation with a variety of different compu-tational tools (Fortran, C, PVWAVE and Mathcad) a decision was reached tointegrate a single computational tool into all suitable courses in the program.Mathematica was chosen primarily for its strength in symbolic computation andits excellent notebook environment. Both features have important pedagogicalbenefits. The former allows the presentation of many engineering problems intheir standard algebraic form. The latter successfully integrates visualization,computation and presentation features making it a rich communication medium.Mathematica also has a very powerful suite of numerical functions and an in-terpretative environment for algorithm development with a language rich in pro-gramming paradigms. Together it has all the necessary features for easy, naturalprototyping of computational tasks, from simple to complex and their present-ation in a superior documentation format. Starting in 1996, all Mathematica-based courses in the electrical engineering program use a newly established com-puter classroom. The classroom is the result of a grant from the National Sci-ence Foundation (Jankowski [4]). Ready access to a modern computer-equippedclassroom has greatly enhanced the use of hands-on computation in the instruc-tional process.

Mathematica has been fully integrated into four junior and senior courses inthe general area of signals and systems: Signals and Systems (ELE314), Com-munications Engineering (ELE483), Digital Signal Processing (ELE486) and Di-gital Image Processing (ELE489). A series of topical lectures has been writtenfor each of the four courses. To support the computational needs in the abovedisciplines, Mathematica 's basic functionality has been extended by the additionof two packages: Signals and Systems [5] package in the Mathematica Applic-ations Library and an Image Processing package written by the the author. TheSignals and Systems packages' emphasis on symbolic techniques helps in per-forming algebraic manipulations on signals and systems (Evans [6]) that tradi-tionally confound the average undergraduate student. Typical examples includesolving difference equations, evaluating the Fourier, Laplace or z-transforms (andinverting them) of basic signals and computing convolutions. The Image Pro-cessing package has been written specifically to support instruction in the senior-level Digital Image Processing course. The package extends Mathematica in thearea of two-dimensional (2D) discrete transforms, 2D linear and non-linear im-age operators and miscellaneous point-based operators.

Recent improvements in computer hardware and software have had a signi-ficant positive impact on Mathematica 's performance and cost-effectiveness. It

Transactions on Engineering Sciences vol 15, © 1997 WIT Press, www.witpress.com, ISSN 1743-3533

Page 5: 274 Innovation In Mathematics - WIT Press · student's lack of adequate mathematical skills is one of the primary barriers to effective learning, and ultimately, successful completion

Innovation In Mathematics 277

is finally possible to run Mathematica on a standard desktop computer with ac-ceptable computational performance. Present day Pentium and PowerPC basedworkstations have adequate system resources for most computational problemstypically encountered in an undergraduate science or engineering curriculum.Consider the following example calculations frequently encountered in imageprocessing: 2D FFT, histogram, and 2D time-domain convolution. The imagesize is 128x128 pixels. System specifications are: Pentium 133 with 32MB RAM,WindowsNT4.0, and Mathematica 3.0.Load the image processing package andread an example image.

Needs|"ImageProcessing'"];a=ReadBinaryDataI"cokel28.bin",DateFormat->"Raw"];

Obtain timing data for three typical image operations.

Timing[InverseFourier|N[a]];| //First

1.l*Second

Timing|Histogram[a|;| //First

10.82*Second

kernel=Table[l.,{3},{3}!/9.;Timing[DiscreteConvolve[a,kernel,

FFT->False);| //First

23.78*Second

4 Digital Image Processing with Mathematica

Digital Image Processing (ELE489) is a senior-level elective that, in spite of therelatively complex mathematics involved, attracts a lot of student interest. Typic-ally, however very little image "processing" actually occurs, since the traditionalcomputational tools are not suitable for the classroom, especially in the contextof interactive lectures. This leads to disappointment and eventual loss of intereston the part of the student. At the same time, the many interesting computationalproblems in digital image processing are an excellent vehicle for teaching digitalsignal fundamentals. ELE489 class was the first in the program to use Mathem-atica in a computer classroom during lectures. In the 28, 1 ̂ hour class sessionstime was split about evenly between more or less traditional lectures and Math-ematica based instruction.

The course is an introduction to the basic concepts and methodologies fordigital image processing. The textbook "Digital Image Processing" by Gonzalez

Transactions on Engineering Sciences vol 15, © 1997 WIT Press, www.witpress.com, ISSN 1743-3533

Page 6: 274 Innovation In Mathematics - WIT Press · student's lack of adequate mathematical skills is one of the primary barriers to effective learning, and ultimately, successful completion

278 Innovation In Mathematics

[7] was supplemented by 12 Mathematica notebooks, covering the major top-ics of the course. Each of the notebooks was used in one or more of the lecturesessions held in a computer-equipped classroom. In addition to the notebooks,an Image Processing package was written that extends Mathematica s standardcapabilities by adding functions of interest to the image processing professional.These include image transforms, functions that allow manipulation of image con-trast, standard 2D linear and non-linear image operators, 2D matrix manipulationand a few utility functions. Two short examples of the packages functionality areshown below.

Example 1. Discrete Cosine Transform (DCT) and image com-

pression.

The DCT is an important unitary transformation. It is a real transformation witha fast algorithm and superior energy packing ability (in the mean squared errorsense) compared to the DFT. For these and other reasons, it is now an integralpart of two lossy image compression standards JPEG (Joint Photographic Ex-perts Group) and MPEG (Moving Pictures Expert Group). Here is the DCT ofour example image.

Show(GraphicsArray[ListDensityPlot|#l, Mesh->False,

Frame->False, DisplayFunction->Identity]&/@{a,DCT[a|}]];

Figure 1: A sample image and its DCT.

The JPEG standard is the most widely known standard for lossy image com-pression of still-frame imagery. A part of the core baseline algorithm is a trans-form coding scheme using DCT (for details see Pennebaker [8]). The input im-age is level shifted by subtracting 128 from each pixel. The image is partitionedinto 8x8 blocks, then transformed using 8-point DCT. Finally, the coefficients arequantized using a standard quantization table Q, which effectively reduces most

Transactions on Engineering Sciences vol 15, © 1997 WIT Press, www.witpress.com, ISSN 1743-3533

Page 7: 274 Innovation In Mathematics - WIT Press · student's lack of adequate mathematical skills is one of the primary barriers to effective learning, and ultimately, successful completion

Innovation In Mathematics 279

of the low-order coefficients to zero. Shown below is a Mathematica implement-ation of the transform coding portion of the JPEG algorithm. BlockProcessingis an ImageProcessing function that accepts a function f, a data array arr, andpartition size dimensions and applies f to every block of arr. It returns an arrayof the same size and dimensions as arr.

Q={ {16,11,10,16,24,40,51,61},{12,13,14,19,26,58,60,55},{14,13,16,24,40,57,69,56},{14,17,22,29,51,87,80,62},{18,22,37,56,68,109,103,77},{24,35,55,64,81,104,113,92},{49,64,78,87,103,121,120,101},{72,92,95,98,112,100,103,90}};

coeff=BlockProcessingIRoundIDCT[#ll/Q]&, a-128, {8,8}];

The number of non-zero coefficients in array coeff is a simple estimate of thecompression factor.

Select[Flatten[coeff],(#l =!= 0) &] //Length

1496

The compression ratio is typically stated in bits-per-pixel. Assuming uni-form coding using 8-bits per DCT coefficient (in reality a more efficient non-uniform coding scheme is used) we get

N|8%/128%2|bpp

0.73*bpp

Next, an approximation to the original image is computed and the recon-structed image and the quantization error signal are shown.

b= BlockProcessing[Round|InverseDCT[Q * #1]+128]&,coeff, {8, 8}];

Show[GraphicsArray[ListDensityPlot[#l, Mesh->False,

Frame->False, DisplayFunction->Identity]&

Transactions on Engineering Sciences vol 15, © 1997 WIT Press, www.witpress.com, ISSN 1743-3533

Page 8: 274 Innovation In Mathematics - WIT Press · student's lack of adequate mathematical skills is one of the primary barriers to effective learning, and ultimately, successful completion

280 Innovation In Mathematics

Figure 2: DCT block coding of the sample image.

Example 2. Edge Operators

An edge is a boundary between two regions of dissimilar brightness. Edge de-tection is an important first step in many image analysis tasks because it leads toa segmentation of an image (i.e. the breaking of an image into constituent parts).The Image Processing package implements a number of well known edge oper-ators including Roberts, Prewitt, Sobel and Laplacian-of-Gaussian (LoG). TheSobel edge operator, is an example a gradient edge operator, while the LoG isan isotropic, second-derivative based edge operator. The results of applying thetwo edge detectors to the example image are shown.

Show|GraphicsArray|ListDensityPlot|#l, Mesh->False,

Frame->False, DisplayFunction->Identity]&/@ {Edge[a|,ZeroCrossing[LoG[a, 5)1}]];

Figure 3: Result of using Sobel and LoG edge operators on the sample image.

Transactions on Engineering Sciences vol 15, © 1997 WIT Press, www.witpress.com, ISSN 1743-3533

Page 9: 274 Innovation In Mathematics - WIT Press · student's lack of adequate mathematical skills is one of the primary barriers to effective learning, and ultimately, successful completion

Innovation In Mathematics 281

Acknowledgment

The author would like to thank Wolfram Research for supporting the develop-ment of the course materials for the Digital Image Processing course through theVisiting Scholar Program.

References

[ 1 ] Dorato, P. A survey of control systems education in the United States, IEEETrans. Education, 1990,33.

[2] Johnson, D.W., Johnson, R. T. & Smith, K. A. Cooperative learning: In-creasing college faculty instructional productivity, ASHE-ERIC Reports on

?, Washington, DC: ERIC, 1991.

[3] Simonich, P.J. & Peruse, M.R. Propagating Mathematica across the UnitedStates Air Force Academy curriculum, in IMS-95, pp. 341-349, ProceedingsFirst International Mathematica Symposium, Southampton, U.K., 1995.

[4] Jankowski, M. A Computer Classroom for Electrical Engineering: Improv-ing Teaching and Learning, A#FD[/E-P6J025J, 1996.

[5] Signals and Systems Pack User's Guide, Wolfram Research, Inc., Cham-paign, IL, 1995.

[6] Evans, B.L. et al. Learning signals and systems with MathematicaJEEE/7.9. Edwcaf/ow, 1993, 36, 72-78.

[7] Gonzalez, R.C. & Woods, R.E. Digital Image Processing, Addison- Wesley,Reading, Massachusetts, 1992.

[8] Pennebaker, W.B. & Mitchell, J.L. JPEG Still Image Data Compression, Van Nostrand Reinhold, New York, 1993.

Transactions on Engineering Sciences vol 15, © 1997 WIT Press, www.witpress.com, ISSN 1743-3533