Counted Looping and Waveform Plots
John M. Essick · 2024
Abstract The properties of a digitized waveform are studied as readers write a sine-wave plotting program. Plotting of the digitized sine-wave data is facilitated by Python’s Matplotlib library, while the digitized data are generated by three counted-looping methods—for loop, list comprehension, and vectorization. The latter method is realized through the array-based mathematics of the NumPy library. Python’s iterable data structures called list and string are discussed, along with the various ways prewritten software can be imported into a Python program. Finally, the procedure for placing a Matplotlib plot on a GUI is implemented. In a Do It Yourself project, readers create a for-loop-based simulation that explores the statistics of tossed coins and a Use It! example implements a for loop to sum a sequence of numeric values.