Purdue University
School of Electrical and Computer Engineering

Digital Signal Processing Demonstrations


Overview:

These demonstrations are a compilation of Matlab scripts which have been used as lecture supplements for EE438: Digital Signal Processing with Applications. Contributors include Prof. Jan Allebach, Prof. Charles Bouman, and Prof. Michael Zoltowski.

The Matlab scripts have been written over a period of several years, therefore some problems may occur when running them on the latest release of Matlab. They should currently be compatible with Matlab 6.1.

If you are unfamiliar with Matlab, please refer to Purdue's ECN Matlab tutorials.


Basic Signals and Systems

Directory

Signal Operations in Matlab

Signal_opps.m : Illustrates how to do basic signal manipulations in Matlab, namely time-shifting, time-reversal, up sampling, and down sampling.
Signal_opps_appl.m : Performs the above operations on a speech signal, and the results are played through the sound card.
*Requires the ascii data file erf1s1t0.

System Analysis

System_1_char.m,   System_2_char.m : Shows time and frequency domain properties of two different systems.
*Requires the additional scripts:   system_1.m,   system_2.m,   sig_1_gen.m,   sig_2_gen.m,   dtft.m.

analyzer.m : This script looks at the frequency-domain effects of clipping a signal. Signal-to-noise ratio and total harmonic distortion are computed.
*Requires the additional scripts:   sig_3_gen.m,   system_3.m,   dtft.m.


Filtering

Directory

Linear Difference Equations

notcheg1.m : Application of an IIR notch filter to a corrupted speech signal.
notcheg2.m : Application of both IIR and FIR notch filters to a corrupted speech signal.
*Both demos require the ascii data file erf1s1t0.

Z-Transforms

zpgui.m : Illustrates the correspondence between the z-transform and frequency response for a rational transfer function. A user interface allows the poles and zeros to be placed, and the corresponding frequency response is plotted.


Aliasing

Directory

aliaseg1.m : A word utterance is effectively sampled at four different rates and played back to hear the effects of aliasing. The spectral effects are also illustrated.
aliaseg2.m : Same as previous example, but low-pass filtering is applied to prevent aliasing.
*Requires the ascii data file enf1s1t0.


Windowing

Directory

Truncation Effects

spectral_analysis.m : Illustrates the effect of truncating a time-domain signal by showing the correspondence between spectra of the orignal and truncated signals.
trunceffects.m : Illustrates the effect of truncating a sum of two sinewaves. The effects are analyzed as a function of the separation in frequency and the differential in amplitude amongst the two sinewaves.
windowedsines.m : Illustrates the effect of multiplying a data block by a tapered window vs. no windowing.

Window Properties

windowseg.m : Illustrates the spectra of various windows.
windowseg2.m, : Illustrate the sidelobe cancellation and mainlobe widening effects achieved with a sine window, relative to a rectangular window of the same length.


Discrete Fourier Transform

Directory

Sampling the DTFT

sineDFTeg.m : Sampling the DTFT of a finite length sinusoid.

Circular Convolution

circ_conv.m : Illustrates the correspondence between convolution in the time-domain and multiplication in the discrete frequency domain.

Time-Domain Aliasing

timealias.m : Illustration of time-domain aliasing due to choosing an improper length DFT.


Sampling Rate Conversion

Directory

ups_dwns.m : A speech signal is downsampled and upsampled, the spectra are plotted, and the results are run through the sound card. No low-pass filtering is performed in either case.
dec_int.m : Same exercise as above, except a low-pass filter is applied before downsampling and after upsampling.
*Requires the ascii data file erf1s1t0.

Upsampling

upsample1.m : Upsampling a speech signal by a factor of two.
upsample2.m : Similar to the above demo, but the upsampling is performed with the more efficient polyphase implementation.
*Requires the ascii data file enf1s1t0.


Multiplexing

Directory

This stereo.pdf document provides some background on stereo multiplexing.

stereo_mux.m : Script for multiplexing two audio signals.
*Requires the data files:   erf1s1t0,   ysf1s1t0.


Random Signals

Directory

random_signals_1.m : Computes the sample mean as a function of the sample size.
random_signals_2.m : Correlation between a signal and a version with additive noise.
random_signals_3.m : Computes a histogram.
random_signals_4.m : Illustrates the effect of filtering a white random sequence. The output autocorrelation and scatter plots are generated.


Speech Analysis

Directory

speech_plot.m : This script plots the different sections of a speech signal.
*Requires the ascii data file erf1s1t0.

Effects of Quantization

quantizeb2.m : A speech signal is quantized to a specified number of levels. The results are played through the sound card, and quantization error and signal spectra are computed.
*Requires the ascii data file erf1s1t0.

Effects of Zero-Order Hold

ZOHeg1.m : The effects of a zero-order hold process are played through the sound card.
*Requires the ascii data file 00f1s2t0.


2D Signals and Systems

Directory

Basic 2D Signals

circ_jinc.m : This generates a circ function and computes its 2D discrete Fourier transform (DFT).
cos2d.m : This generates a spatial cosine wave and computes its 2D DFT.
cos2dxcirc.m : This combines the previous two results by computing the product of a spatial cosine and a circ function.
rect_sinc2d.m : This generates a 2D rect function and computes its 2D DFT.
grating.m : This computes the spectrum of a grating pattern, which is encountered in many digital acquisition systems.

2D Operations

sine_sampling.m : This illustrates the effect of undersampling a 2D sinusoid.


Tomography

Directory

Run.m : Matlab script which runs a convolution back-projection demo. A phantom image is generated and the forward projection of the phantom is computed. A back-projection filter is then applied to each projection, and the image is reconstructed. All the following scripts are required.

Phantom.m : Generates the phantom image.
Project.m : Computes projections of an image at a specified set of angles.
CBPFilter.m : Computes the impulse response of the back-projection filter.
BackProj.m : Computes the back-projection using a specified set of projection angles.
DisplayImg.m : Displays a grayscale image.


Image Enhancement Demos

These demonstrations run a Matlab GUI to allow user interaction.

Directory

filtdemo.m : Linear filtering of images (low-pass, high-pass, edge-dection).
*Requires the data file demo1.mat.

histdemo.m : Image histograms and pixel transformations.
*Requires the data file demo2.mat.

sampdemo.m : Image sampling and reconstruction.
*Requires the data file demo1.mat.


Questions or comments should be sent to: