Introduction to Experiment 2 – Fall 2018: 

Digital Signal Processing and Fourier Analysis

 

1.0 Overview:

In this lab, you will be introduced to Digital Signal Processing (DSP) and Fourier analysis through the comparison of experimental, theoretical and simulation techniques. As we have discussed in lecture there are three main sources of error encountered when digitizing signals: clipping, quantization, and aliasing.

In the simulation portion of the lab you will be using a graphical interface to explore various issues of DSP using simulated waveforms generated by the host program, LabVIEW. We will demonstrate aliasing and how to minimize it by using analog low pass filters. You will also examine different waveforms, (sine waves, square waves, and triangle waves), as well as non-harmonic functions (white noise) in both the time and frequency domains. The frequency domain requires knowledge of Fourier integrals. The results from the simulation will be compared to the experimental and theoretical results with proper knowledge of the relative uncertainty of each technique. You will obtain enough information in lab to compare your results to Fourier theory. Before performing this lab you should review the notes on aliasing and Fourier analysis.

1.1 Required Equipment:

·         National Instruments system with LabVIEW

·        A/D Converter

 

o   13 bits

 

o   48 KS/s – max sample rate

 

o   AI FIFO 512 bytes

 

o   Input range +/- 10 Volts

 

o   Working voltage +/- 10 Volts

 

o   Input impedance 144 kΩ

·         Function Generator (B&K sine and square wave generator)

·         1 SMB to BNC cable

1.2 Objectives:

·         Introduce the concepts of signal digitization and quantization.

·         Demonstrate aliasing, filtering, clipping and quantization error.

·         Introduce Fourier analysis.

·         Demonstrate the use of computer simulations in laboratory environments.

 

2.0 Pre-Lab

2.1 Digital Oscilloscope Simulation

Important Note when saving your data:  Make sure you keep track of the file names in your lab notebook!

·       Select a “Sine wave” as the input function using the ‘Wave Type’ pull down menu in the ‘Signal Generation’ section.

·       Set the frequency to 750 Hz.

·       Set the signal amplitude to 3.0 volts

·       Set the sampling frequency to 25 kHz.

·       Set the number of samples to 8192.

·       Select “12 bit resolution.”

·       Set the bipolar range to 10 volts.

·       Set Filter to OFF.

·       Press the Green Run Button.

·       Write a file name ending in .txt in the “File Name” box. Make sure you record which test it corresponds to. The file will appear in whatever file you have open in MATLAB.

·       Set Write to file to on and press the green button.

·       What is the significance of the frequency plot here? Why is there no aliasing?

2.2 Quantization Error and Resolution

·       Keep same settings as 2.1 but change the bit resolution to 4.

·        Remember to "Save" the data.

·       Notice the discrete steps the waveform takes, think about why this is occurring and be prepared to discuss in lab.

2.3 Clipping

·       Now change the bit resolution back to 12.

·       Change bipolar range to +/- 1 volt.

·       Save the data

·       Why are the tops of the sine wave now flat? Be prepared to discuss in lab.

Plot all 6 figures and bring them to lab to turn in.

 

 

3.0 Simulation

3.1 Fourier Analysis Simulation

In this case, you will be simulating the experiment from section 4.0 using two waveforms, a square wave and a sawtooth wave, in both the time and frequency domains. Be sure to make the appropriate comparisons to theory and to the experiment in your report.

·       Select the square wave from the input function pull down menu.

·       Set the waveform frequency to 750 Hz.

·       Set the sampling frequency to 25 kHz.

·       Set the voltage to 3V.

·       Set the bit resolution to 12.

·       Set the bipolar range to ±10V.

·       Set the number of samples to 8192.

·       Turn on “Write to file” and name file appropriately (keep note of file name and corresponding simulation).

·       Press the "Run" button.

·       Note the shape of this plot.

·       Repeat this section by activating the lowpass filter and setting the cutoff frequency to 10 kHz. Note the changes in the shape of the square wave. What caused this change in the square wave to occur?

·       Remember to "Save" the data.

·       Run the simulation again with the cutoff frequency set to 5 kHz and save the data.

·       Repeat this procedure for the sawtooth wave. Further investigations with other waveforms may be performed as well. The triangle and white noise waveforms are available in this simulation.

You should compare your results with those from the experiment and theory. Are the amplitudes of the peaks in the frequency domain consistent between experiment, simulation and theory? Also, be sure to include an uncertainty analysis. How does uncertainty play a role with simulated data? What are the advantages and limitations of the three methods of analysis (experiment, simulation and theory).

 

4.0 Experiment   

          Important Note when saving your data:  Make sure you keep track of the file names in your lab notebook!

In this portion of the lab, you will use a digital computer to acquire and analyze actual signals from the necessary hardware using an A/D converter.

 

4.1 Digital Signal Acquisition (Digital Time History and Spectra)

·         Set the waveform selector to a sine wave.

·         The function generator frequency should already be set to 750 Hz, do not touch the knob.

·         The function generator amplitude should already be set to 3.0 V, do not touch the knob.

·         On the Labview VI select a sampling rate of 25 kHz and set the number of samples to acquire to 8192.

·         Press the "Run arrow” located in the top of the LabVIEW tool bar.

·         Measure the actual frequency of the sine wave. (NOTE: The mouse can be used to move the cursors on the plots.)

·         Use the cursor to get an accurate value of the frequency at which the peak is located. Compare these values with those obtained from the simulation.

·         Note that at this frequency the signal is not aliased. Why?

·         Recheck all the settings, both on the function generator and the VI panel. If everything is correct, activate the “Write to File” and rerun this section.

 

4.2 Anti-Aliasing and filtering

·    Repeat the process from above for a sampling frequency of 1000 Hz.

·         Note that at this frequency the signal is aliased. Why?

·         Recheck all the settings, both on the function generator and the VI panel. If everything is correct, activate the “Write to File” and rerun this section.

·     Now run a square wave function generator through the Krohn-Hite filter at a Low-Pass setting of 12.5 kHz and set your sampling frequency to 25 kHz. How do we know there is no aliasing?

·       Set Low-Pass setting to 5 kHz and run, how do your time and frequency plots vary? What peaks appear?

·       Set Low-Pass setting to 1 kHz and run, what type of function do you observe from your original square function being generated?

·         Recheck all the settings, both on the function generator and the VI panel. If everything is correct, activate the “Write to File” and rerun this section.     

 

4.3 Fourier Analysis Experiment

In this part of the experiment, you will examine a square wave, in both the time and frequency domains. You will obtain enough information here to compare your results to Fourier theory and to the simulation data. Make sure that you perform these comparisons in your report.

·         Select a square waveform at 750 Hz

·         Select a sample rate of 25 kHz.

·         Make sure you obtain the amplitude and frequency of the wave from the time trace. (NOTE: This can be done quickly in the lab, using the mouse driven cursors on the VI panel, or later by slowly scanning a spreadsheet column containing thousands of points.)

·         Make sure to get a value of the frequency and amplitude of the various peaks in the frequency domain.

·         Why is there more than one peak? Why are the peaks in the Fourier domain at their particular frequencies? Are the amplitude of the peaks consistent with those from theory? Be sure to include the     relevant uncertainty analysis for the measured quantities

·        Repeat the process for a sawtooth waveform (all the way counter-clockwise on waveform generator).

·        Change over to the B&K function generator on the table and make sure it’s on the white noise setting. Set the sampling frequency to its highest setting (40kHz) in the vi.

·       Set the Krohn-Hite low-pass filter cut-off frequency accordingly to prevent aliasing ( Sampling Frequency = 20kHz).

·       Now set the low-pass filter cut-off frequency to half of that (10kHz), what do you notice about the peaks in the frequency domain?

·       Analyze the decay of the frequency spectrum around its Nyquist frequency. A good filter has the ability to decay rapidly, where as poor filters decay much more gradually, thus allowing aliased signals to infiltrate and corrupt the digitized data.

 

Additional Questions you should address

·         Why do the aliased signals from the simulation and experimental cases without the filter, show up at this particular frequency? Either use the calculations shown in the notes or the aliasing diagram to demonstrate why the aliased signal shows up at that particular frequency.

·         Why does the aliased signal disappear when low pass filtered at half of the sampling frequency?

·         What are some examples of aliasing in other real world situations?

·         What would the frequency spectrum look like for a white noise input function, sampled at 25kHz and band pass filtered between 5kHz and 20kHz.