Lab #3 report for Physics 122 - Frequency Analysis, Resolution, Noise, Aliasing, Filtering
Student Name: Lab Partner:
Exercise 1: Measurement Resolution in Analog-to-Digital Conversion
a) By looking at the recorded data points determine what is the smallest voltage change that is resolved? Does the observed resolution agree with the specification for the USB-6212 card?
b) Include the zoomed-in plot in your report.
c) What is the smallest resolved voltage change if the analog input range is set to -5 to 5 volts?
Exercise 2: Frequency Analysis and Aliasing of Acquired Signals
b) Set the FFT graph to show the interval from 0 to 200 Hz. With the signal being recorded is there a clear peak at 130 Hz in the FFT? Include this graph in your report
c) Does the height of this peak equal the amplitude of the recorded sine signal?
d) The function generator may not generate a perfect sine wave, so other frequency
components and noise may also be present. Change the plotted FFT range from 0 to 1000 Hz and change the amplitude axis to a logarithmic scale (right clicking the axis and select "Mapping > Log") so as to better see small and large components on the same graph. Include this graph in your report and note down any other prominent frequency components are present besides 130 Hz.
g) What happens if you reduce the sampling rate to 100 Hz? Why?
Exercise 3: Analysis of Noise in Data Acquisition
a) Add code to make your analysis program calculate the mean value and standard deviation b) Set the input range of the card to its most sensitive level (-0.2 to 0.2 volt range). Wire the
two differential input terminals ( positive and negative) together with a short piece of wire so that nominally you should measure "zero volts" (plus whatever noise is present) and record this to determine the FFT (averaged for 10 seconds – allow the loop which records 1 s of data to iterate ten times). Note that this is effectively a "floating signal source", so the inputs to the DAQ need to be wired up with "bias resistors" to DAQ ground as addressed in the prelab HW questions for lab #2 (submitted with the lab#1 report). What is the measured mean and standard deviation?
What does the FFT look like (plotted with log scale on both axes)?
c) The DAQ card can be "self-calibrated" in the measurement and automation explorer program by right clicking on the listing for the USB-6212 card. Do the results change after doing this?
e) Investigate what happens to the CMRR if you change the common mode signal to 10 kHz. Is this consistent with information given in the USB-6212 spec sheet?
Exercise 4: Analysis of Noise Produced by Power Supplies and Batteries
a) Characterize the voltage output by the "5V" terminal on the DAQ card. Set the input range to -10 to 10V. Document the mean, standard deviation,
and use the FFT (with log axis scale for amplitudes) to identify the most prominent noise frequencies.
b) Characterize the voltage output by the "5V" terminal on the benchtop power supply. Compare the mean and standard deviation to that of the DAQ card 5V supply
c) Characterize the voltage output from an analog output channel on the DAQ card set to output 5 volts. Compare the standard deviation to that of the 5 V power supply
and plot the FFT for both (with plot axis ranges set the same for both). Discuss how the FFTs compare.
d) Characterize the voltage output from a 9V battery. Compare the standard deviation to that of the 5 V power supply
Exercise 5: Analysis of Noise Arising in Wiring
a) As in Exercise 3, attach a very short wire between the terminals of a differential analog input. Acquire data at the maximum rate input range -0.2 to 0.2 volts for 10 seconds. Determine and write down the standard deviation.
Determine the FFT (averaged for 10 s, using log axis scales).
b) Longer wires supposedly pick up more noise. Investigate this by attaching a ~1 meter long wire between the differential inputs, with the wire in a circular loop on the table. Compare with the case of short wires in terms of standard deviation and FFTs.
Show and discuss how the FFTs compare. Note any prominent noise frequencies. Do you see evidence for "60 Hz" noise (or harmonics?) which typically originates from building power lines (because electricity is delivered as AC volts at 60 Hz)?
d) Configuring wires as a "twisted pair" (as illustrated on the right) supposedly reduces electrical noise pickup. Try reconfiguring the long loop of wire to mimic a twisted pair (a loop has no end, but you can imagine it to be two wires connected at the middle point of the wire and measuring "0 volts"). Drape the twisted wire over the computer monitor. Compare and discuss standard deviations and FFTs for the twisted pair vs. the open loop, and with the scope turned on and off.
Exercise 6: Averaging, Smoothing, Digital Filtering
b) Using a second "Simulate Signal" function and the "+" arithmetic function add a 1000 Hz sine wave, Amplitude=1 with 10,000 samples per second and 10,000 samples to the 100 Hz sine wave. Use the Express > Signal Analysis > Filter function "smooth" the signal with a "rectangular moving aperture". Plot the original signal and and filtered signal for comparison.
Adjust the half width of the aperture (which is half the number of points being averaged) to try to smooth out the 1000 Hz sine wave while leaving the 100 Hz signal intact.
c) What happens to the 100 Hz signal if you smooth enough to reduce the 1000 Hz signal by 90%?
d) What is the most you can reduce the 1000 Hz signal while keeping 90% of the 100 Hz signal
e) Change the 1000 Hz signal to 200 Hz. What is the most you can reduce the 200 Hz signal while keeping 90% of the 100 Hz signal?
f) Change the filter type to a low pass IIR "Butterworth" filter with 4 poles and a "150 Hz" cutoff. How well does this separate 200 Hz from 100 Hz? What happens if you increase the number of poles?
g) Is there any disadvantage to increasing the number of poles? (Hint: look at the signal vs. time signal before vs. after filtering)
Exercise 7: Characterization of an RC analog filter
a) Write a Labview program that acquires a signal for 3 seconds and then uses the "Tone measurements" function to determine the amplitude and frequency of the signal. Test that this program works using the benchtop function generator.
b) Build a low pass RC filter using a 47 nanofarad capacitor (in box labeled "0.05 microfarads") and 22 kΩ resistor and calculate the theoretical cutoff frequency.
c) Send signals ranging from 100 Hz to 1000 Hz in steps of 100 Hz through the RC filter and determine the attenuation factor factor (
V
out/
V
¿¿
for each frequency.Exercise 8: Response of an RC Analog Filter to White Noise
(d) Read the recorded FFT data into Matlab and compare the results with those
theoretically expected and measured in Exercise 7 (plotting on a log-log plot). Note:
V
¿ at any particular frequency for the white noise signal is not 10V, as that amplitude ispartitioned across all frequencies. You can determine the effective
V
¿ by looking at the FFT amplitude at low frequency (sinceV
out=
V
¿ at low frequency).. Homework and Pre-lab Questions for Lab #4
Relevant references (posted on the class website under the "Radioactive Particle Counting" link):
“Geiger counter notes”, “Primer on Geiger Counters”, “Primer on Ionizing Radiation” “Matlab Primer” PDF book
1. Briefly explain how a voltage pulse is generated by a Geiger counter when a radioactive particle enters, and what is the meaning of “dead time”?
2. Use the following references to help you answer the questions below: https://en.wikipedia.org/wiki/Poisson_distribution
https://en.wikipedia.org/wiki/Probability_mass_function https://en.wikipedia.org/wiki/Exponential_distribution https://en.wikipedia.org/wiki/Probability_density_function
(b) What is the probability that a count will be detected within 1 second after another count?
3. Read through the first chapter of the Matlab primer ("getting started") and type in and run all the examples (some individual commands are just typed on the command line and directly run, and some short multiline scripts are entered in the editor and then run). Skim through the rest of the sections of the primer highlighted in yellow. You will find this to be a useful reference for Lab #4. (Note: you don't have to turn in anything for this problem…).
4. Some additional "Doug's favorite Matlab tips" are listed below. Try running each of these to see what they do. Some commands may be useful in Lab #4. Paste the resulting graphs into the boxes.
Zooming in to look at plotted points
After making a plot, it is often useful to use the "magnifying glass" and "hand" tools (at the top of the plot window) to zoom in and pan around to look closely at the plotted data. Right click to zoom back out. You can also program the
plot(rand(100,1),'.-');
Read and write data files (the simplest way)
Type two columns of numbers into a text file and save it (or type them into Excel and export the spreadsheet as text). These can be read in to Matlab as follows:
cd('directory name'); data=load('file name');
To see what you've got, type "size data", which will tell you the number of rows and columns. For example, "1000 2", meaning 2 columns each with 1000 numbers in it. Then extract and plot the data as follows
t=data(:,1); v=data(:,2); plot(t,v);
To save these t and v values in a format Matlab can easily read later (a ".mat" file). I can just type
save('test');
This saves all the variables in the current memory ("workspace"). If I only wanted to save "v" and not "t", I could instead type
save('test','v');
Type "clear" to clear memory and to re-read in the data type "load('test');" and "who" to see what variables you have. One thing to be careful about is if you have a program where you define a variable such as "y" and then later load a .mat file which also has a variable y in it. The original y will get overwritten!
Print info in the plot title
Saving numbers in an array in a loop
clear; close all;
xvals=[];
for i=1:100
x=i*rand(1,1); xvals=[xvals x];
end;
y=randn(10000,1);
hist(y,20); % 20 refers to the number of bins
Logical Indexing
clear; close all;
x=rand(1000,1);
x(x<0.2)=0; % set all x<0.2 to zero
plot(x,'.');
ibig=find(x>0.8); % find indexes of all x>0.8