PY 452 Advanced Physics Laboratory

Hans Hallen

Signal Processing Exercises

The signal processing lecture stressed a few important concepts that you all should understand and be able to use: quantization in 'space' and time by digital data acquisition; the Fourier transform, both discreet and continuous, and its use in spectral analysis, convolution, and correlation; and image processing. The following exercises will help you to reach that goal. Do not forget to study the diagrams on the vi's, to see how these things are done! A written report is due, and should include a section for each of the above, with equations and captioned figures that are referenced in the text. The discussion should be complete enough to demonstrate your familiarity with these concepts. Questions in the writing below give guidance to the topics that should be covered.

Quantization in voltage

In the lab we have USB data acquisition (DAQ) devices with 14-bit analog to digital converters (lower resolution outputs), DAQ cards for the PCI bus with 16-bit DAQ inputs (and outputs), and oscilloscopes that are much faster but only have 8 bit resolution. Find the minimum voltage resolvable for the three cases assuming a -10 -> 10 V range for the DAQ devices, and also a 20 volt range for the oscilloscope. The DAQ devices have programmable gains, and the oscilloscope gain is easily adjusted on the front panel. Comment on why it is important not to neglect these abilities. Interestingly, this is a case when noise can be helpful. If the noise level is sufficient to spread the samples of a measurement across more than one bit, then an average will give better resolution in voltage than the resolution of the analog to digital converter, the ADC (assuming the ADC is perfect), whereas noise less than one bit will cause the ADC to always return the same value, which will be wrong if the true value lies between two values.

Quantization in time

You probably learned in the LabView exercise about the Nyquist frequency, and its relation to the sampling frequency (half). This will become more apparent in the following discussion of the discreet Fourier transform. For now, consider a sampling rate of 10,000 samples/s, and derive the maximum measurable frequency. Recall that signal at frequencies larger than this will be aliased (reflected about the Nyquist frequency, and if needed reflected again about zero frequency, …). At what frequency would a 7,500 Hz tone show up at? a 22 kHz tone? Also recall that the time-plot of the samples of a signal near the Nyquist frequency will show a beat pattern between that frequency and the Nyquist frequency.

Fourier transform

The Fourier transform is a projection of a signal that depends upon time onto sines and cosines, specifically exp(i2πft) = cos(2πft) + i*sin(2πft). This is written as an integral


The inverse is the same for the continuous case except there is no '-' in the exponential; the discreet case also has a 1/N factor in front. Note that the DFT does not include the time unit Δ in front of the summation. The use of f rather than ω in the formulae removes an extra factor of 2π that you may have seen elsewhere. In the discreet time formula, Δ is the time interval between samples, assumed constant. The discreet-Fourier transform DFTk is equivalent to writing the function of time in the basis of those functions, so the projections above are relevant for calculating the coefficients. The N frequencies are N/2 positive and N/2 negative, plus zero (the value at the two max. +/- freq. are the same). It also has the fundamental fact that if you measure N parameters, then you ought to only get back N numbers related to the frequency content. Actually, the Fourier transform is complex, so we appear to be getting 2N. The answers are that: we really sample 2N values (all the imaginary parts were zero); or there must be a symmetry that reduces the number of independent values (you find below). The discreet Fourier transform is almost always calculated by the fast Fourier transform FFT method since the number of calculations is only NlogN rather than N2/2. Use a number of points that is a power of 2 to make this efficient (or zero-pad it to such a size). Why will that not change the frequencies? What is the separation between frequency points in the FFT, the freq/pt? What is the maximum frequency in the FFT? What is another name for the value at a frequency of 0 Hz? What is the ordering of frequencies that LabView outputs for the FFT? (The ordering in the calculation is adjusted to make use of symmetry.) What are the symmetries of the Fourier transform? In particular, relate FT(f) and FT(-f) for real signals, even functions, odd functions, imaginary functions, and combinations. How does the Fourier transform change when the function in time is scaled, shifted in time, has a derivative with respect to time taken of it? A chart could be useful here. What is the meaning of negative frequencies?

Spectral measurements

A common way to determine the spectral content of a signal is with the periodogram, based upon the FFT (an alternative that works better for sharp peaks in the spectra (i.e. sum of sines and cosines) even for non-equally spaced in time samples, is the maximum entropy method – see Numerical Recipes in …) The LabView virtual instrument will help you with the next few parts. Use the vi to calculate the periodogram of the given data sequence with no window. Check the vi, this is a sine wave. Why is it so bad? Move the frequency to lie on one of the frequency points. What happened? Move the frequency back off between points. Now use a window. Start with a wide window (no window is really a window over the whole data set with value 1), then a narrower one. What is the difference? The trade-off between narrower windows (short-time measurements or better time resolution, and width in the frequency domain is what wavelets are all about. See [WC Lang, K Forinash, Am. J. Phys. 66 (9), September 1998]. The reason why windows work is that the Fourier transform assumes that the signal is periodic in the sampling time. If it is not, then there will be a step at the ends of the data (where they are connected to each other), which the FFT will happily incorporate into the transform. Usually it does not have physical significance (it will always have a broad frequency response). What is the FFT of a delta function look like? How will it change as the delta function is shifted in time (recall you calculation/symmetry above).


The convolution is a linear way to combine two functions, with use in solving equations with Green functions and in filtering of digital data. It is defined by


Convolution of a short sequence with a long one is best done in the time domain, as a simple linear filter. Longer convolutions can be computed faster with an FFT. The FT of the convolution is the product of the FT of one times the FT of the other, or FT(g conv h) = FT(g) FT(h). Since the FFT assumes that the signal is periodic, it will have 'wrap-around' problems. How many zeroes must you add to the ends to make sure that this is not a problem? Can you add them all on one end? Where in the array will the good data be when you are finished?


This is the way to find a pattern of one array in another.


where the '*' represents complex conjugation. It is very much like convolution, except the FT of the correlation is the product of the FT of one times the FT of the other at –f (rather than +f -- y changes sign). The FT at -f is the complex conjugate of the FT when the signals are real, so usually you will see FT(g correl h) = [FT(g)]* FT(h), where the * is complex conjugation. The same wrap-around issues apply. See the virtual instrument to determine the shift between the two images in pixels. Do it two times, image 1 correlated with image 2 and vice versa, so you know what the correlation means in term of which way the image shifted. Determine how image 1 shifted to get image two: how many pixels to the right or left and how many up or down. Don't forget to look at the diagram and comment in the write-up.

Image Processing

Fourier methods are important for image processing. See the for two examples, edge enhancement and filtering (you will need to get the subvi's and first). The first is really a convolution, the second involves zeroing of Fourier elements that do not have data content in them. (See Weiner filtering for a more optimal approach). There are also other methods: maximum (minimum?) entropy methods model the image as sharp spikes with weak backgrounds, and can be useful for sharpening images (if your image fits into this category). Look at the entropy levels given by the to describe how entropy relates to image sharpness. Make sure that you vary both noise and filtering widely (leave at least 2 points in the frequency for the filter).