PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. ·...

102
PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March 9, 2006

Transcript of PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. ·...

Page 1: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

PHYS 231 Lab Manual

Department of Physics

Simon Fraser University

Last updated: March 9, 2006

Page 2: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

2

Page 3: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

Contents

0 The Big Picture 5

1 Introduction to Computer-aided Data Acquisition 9

1.1 Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

1.2 Prelab Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

1.3 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

1.4 “Postlab” . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

2 DC Impedances and Measurements 15

2.1 Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

2.2 Prelab Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

2.3 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

3 Probability Distributions 21

3.1 Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

3.2 Prelab Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

3.3 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

3.4 Appendix A: Table for Experiment 1 . . . . . . . . . . . . . . . . . . . . . . 39

4 Radioactive Decay and Interval Distributions 41

4.1 Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

4.2 Prelab Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

4.2.1 The Radioactive Decay Curve . . . . . . . . . . . . . . . . . . . . . . 42

4.2.2 The Interval Distribution . . . . . . . . . . . . . . . . . . . . . . . . . 43

4.3 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

4.4 A more sophisticated analysis of radon decay . . . . . . . . . . . . . . . . . . 48

5 AC Circuits I 51

5.1 Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

5.2 Prelab Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

5.3 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

3

Page 4: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

4 CONTENTS

6 AC Circuits II 576.1 Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 576.2 Prelab Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 576.3 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

7 Mechanical Resonance (2 Weeks) 637.1 Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 637.2 Prelab Questions: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 647.3 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

8 Bug 1: System Calibration 698.1 Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 698.2 Prelab Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 698.3 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

9 Bug 2: Temperature Control 799.1 Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 799.2 Prelab Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 799.3 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

10 Bug 3: RC Decay 8510.1 Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8510.2 Prelab Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8510.3 Experiments: C by RC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85

11 Bug 4: All together now 8911.1 Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8911.2 Prelab Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9011.3 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9011.4 Requiem for a Bug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94

12 Epilog 97

13 Appendix: Programming Concepts 101

Page 5: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

Chapter 0

The Big Picture

Before we jump into the details of this and that lab, it is worthwhile to try to give the bigpicture of what we are trying to do. Broadly speaking, we can say that the goal of thiscourse is to deepen your understanding of what it means to learn something from Nature.This can get very philosophical, but in the context of science, there are two aspects: Howdo we design an experiment to measure things about the world? Once we have done theexperiment, how do we learn something from – i.e., analyze – the results?

As you will see, this is a “how-to” course. In particular, one focus will be on how to usethe computer to accomplish our two goals of doing experiments and analyzing the results.The computer is just a tool that can speed up tedious measurements. Everything can alsobe done by hand – and often, that’s the way we’ll start – but adding a computer can befun and can allow one to take more data than one would normally have patience to do. Inaddition, in our course, we’ll also learn things about electronic circuits and about mechanicalresonance, and so on, but the real focus will be on how to do experiments and analyze resultsfrom them using a computer.

All experiments have several common features. We illustrate them in the diagram below.

Let’s take a look at these various elements. We’ll introduce them briefly here. Don’tworry too much about the details for now. In the lab, you will become familiar with themas the term progresses.

• Physical System: This is the object of your study. In general, the goal of an experimentis to measure some property of this physical system. Typically, one actually wants tomeasure how a physical property changes when some control parameter changes, whileholding all other physical parameters as constant as possible. For example, we willdo a lab at the end of the term where the physical system is a particular kind ofcapacitor. We wish to measure its capacitance (the physical property) as a functionof temperature (the control parameter). We try to hold all other physical parameters,such as the voltage used in the test circuit constant. We will also control, or regulate,the temperature so that it goes to its desired value and stays there while we do ourmeasurement.

5

Page 6: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

6 CHAPTER 0. THE BIG PICTURE

Physical System

Anti Aliasing

Computer

Signal Conditioning

A/D

Power Amp D/A Actuator

Sensor

Figure 1: Elements of an experiment using a computer for control and data acquisition froma physical system.

• Sensor : This is the device used to convert a physical property into a more measurablequantity. In this course, the sensor will almost always convert the physical propertyinto an electrical property. For example, we will use a thermistor, a kind of temperaturesensor that is a resistor whose resistance is a strong function of temperature. We putthe resistor in a voltage-divider circuit, whose output depends on the resistance (andtherefore the temperature). The result is a sensor that converts temperature changesto voltage changes.

• Signal Conditioner The sensor converts a physical property into (usually) a voltage.We then need to measure this voltage. In your first-year lab course, you did this usinga voltmeter, either analog or digital. In this course, we focus on using a computer tomeasure the voltage. The computer will have a data acquisition device (DAQ) (eithera card that goes into a bus slot or, as in our case, an external device that plugs into thecomputer via, e.g., the USB bus). Data acquisition devices use analog-digital (A/D)converters (see below) to convert a physical voltage into a digital number availableto the computer. (Recall that the physical voltage is a continuous quantity – a realnumber – while the digital number in a computer is a series of digits (0-9, or, in itsinternal representation, 0 and 1.) The A/D converters have a standardized voltagerange (often 0-10 or ±10 volts). The voltage given out by the sensor may be muchsmaller. For this – and other reasons we shall discuss later – one usually needs somekind of electric circuit (an amplifier or buffer) that makes the signal appropriate to bemeasured by the A/D converter.

• Anti-Aliasing Filter : Another subtlety of getting data into a computer is that a physicalvoltage V (t) is a continuous function of time, but the computer can only measure a

Page 7: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

7

discrete sequence of voltages. Thus, the continuous voltage is sampled. The anti-aliasing filter is a necessary step in this sampling (again to be discussed later)

• A/D converter : This is the analog-to-digital converter mentioned above. Our data-acquisition card has up to 8 channels that are multiplexed together. (“Multiplexed”means that there is a switch that chooses one of the eight inputs to measure.) TheA/D converter has a resolution of 14 bits (more on this later) and can sample a signalcollectively at 48,000 samples/sec (48 kHz). Because the channels are multiplexed, youcan read one signal at 48 kHz, two signals alternately at 24 kHz, ... , down to eightsignals at 6 kHz. We won’t have to read more than two signals at a time.

• Computer : The above elements all serve to get information about the physical systeminto the computer. For example, if we are interested in the temperature of a system, theresult would be a series of numbers V (t1), V (t2), ... that correspond to the temperatureof the system (well, actually of the sensor) at times t1, t2, ... One function of thecomputer would be to record the raw data coming in. Usually, you would want thecomputer to convert the voltages to temperatures using some kind of previously donecalibration. Then the computer could be used to plot automatically the temperatureon a graph. However, the computer will typically be used for more, too. As wediscuss below, the computer can change the physical system (e.g., by controlling aheater that will change the temperature). This means that the program can actuallyrun the experiment by first setting the temperature, waiting until it stabilizes at thedesired value, and then taking the measurement. Then the program can change thetemperature to the next desired value, etc. To do all of these things, the computer needsto be programmed. We will use two different programs in this course. For controllingand running the experiment and for data acquisition, we will use the program Labview(which uses a graphical metaphor for programming). For analyzing the data we collect,we will use the program Igor Pro (a kind of “spreadsheet on steroids”).

• D/A converter : Digital-to-analog converter. This is the counterpart to the A/D con-verter. It takes a digital number from the computer and converts it into an analogsignal.

• Power amplifier : This is the counterpart to the signal conditioner. It takes the voltagefrom the D/A converter and applies it to the actuator (see below). Because it generallytakes more power to change something in a system than to sense the changes, theamplifier that is used is usually heftier than that used in the signal conditioner.

• Actuator : This is the element that changes the system – the “muscle.” For example,if one wants to control the temperature, the actuator could be a heater (or some kindof refrigerator for cooling). To control a flow of a fluid, the actuator could be a valvethat opens up a flow line. To control light intensity, the actuator could be some kindof lamp or LED. And so on....

Page 8: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

8 CHAPTER 0. THE BIG PICTURE

Now that we’ve listed the basic elements in order, go back and reread the above to get afeeling for how they fit together. Indeed, as we go through the course, you may find it usefulto come back to this introduction to remind yourself about what’s going on at a conceptuallevel.

You should also think back to the labs you did in your first-year lab course. There,you didn’t use a computer, but the same basic elements are still present. For example,you probably investigated Ohm’s law for electric circuits: the voltage V across a resistor isV = IR, where I is the current through the resistor and R is its resistance. You did this byfirst setting a current I. In doing so, you were the actuator – you turned the potentiometerthat set the output of the current source, etc. Then, in reading the needle of the voltmeter(your sensor), you did the “signal conditioning” necessary to get its value into your computer(i.e., your head). Thus, the various elements really were there all the time. We’re just makingthem more explicit here, as we must if we want to automate the whole process. But we’llbe constantly going back and forth between the two modes. Thus, for any experiment, it isessential to do a few measurements by hand to see, at least qualitatively, the effects you aretrying to measure. Then, once you know everything is working properly, you bring in theautomation.

At the end of this Lab Manual is another “Big Picture” chapter, the Epilog, where welist in some detail what we hope you will learn in this course. Feel free to look at it now,but a lot of it will make more sense once we’ve covered those topics during the course.

Page 9: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

Chapter 1

Introduction to Computer-aided DataAcquisition

1.1 Goals

Goals: Introduction to LabVIEW, Igor, and A/D concepts. By the end of this lab, youshould understand how to input a simple signal such as a sine wave into the computer anddisplay the result. You should understand the origins and sizes of quantization and samplingerrors.

• LabVIEW

– Basic metaphors (front panel, block diagrams)

– VI to read in data from function generator, display, store

• Igor

– Basic metaphors (command generation, waves)

– Read in data from a file and display

– Use cursors to extract basic measurements

• A/D

– Basic notions of A/D

– Quantization errors

– Sampling (simple notions of aliasing)

References

• “Getting Started with LabVIEW” tutorial

• Igor Online Guided Tour 1

9

Page 10: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

10 CHAPTER 1. INTRODUCTION TO COMPUTER-AIDED DATA ACQUISITION

1.2 Prelab Questions

There are no prelab questions for the first week, but there will be for future labs. Pleasehand them in on a separate sheet of paper before the start of the lab. For this lab only, wewill have “Postlab Questions” (see below).

1.3 Experiments

Note. You are expected to note your observations in your lab notebook. For the computerexercises, print out relevant things and tape into your lab book. For LabVIEW, this willinclude a representative front panel. For Igor, this will include printing out graphs. In futureexercises, you will be asked to email to the TA your LabVIEW and Igor code files.

1. Connect the function generator to the oscilloscope. Adjust the frequency and amplitudeknobs of the function generator in order to display a 1 kHz, 1 V p-p (peak-to-peak) sinewave properly. (Use the oscilloscope to estimate amplitude and frequency.) For thispart, we will not worry about estimating the uncertainties of frequency and amplitude.

2. (Done as a group.) Write a LabVIEW VI (“virtual instrument”) to input data anddisplay on computer.

• Do first with a simulated source. (LabVIEW has this as a standard block.)

• Then do with a real source. (Configure as differential input.1 See Fig. 1.1.)

• Add save feature to VI.

3. (Done as a group.) Introduction to IGOR

• Read in data from disk. (Use the Data/ Load Waves/ Load General Text...menu item.)

• Display graph. (Use Windows/New Graph...)

1Single vs. differential inputs: The inputs to the A/D converter can be connected in two different ways.In the single-input method, the positive output of the circuit is connected to the analog input of the A/D.The signal is measured with respect to the ground of the A/D, which is set to the computer, which is setto the power supply. In the differential-input method, you connect two wires from your circuit to the A/D.The signal wire (positive output to positive input) is connected as before. But now you also connect theground of the circuit you are measuring to the corresponding negative input to the DAQ. The A/D converterthen measures the difference between the positive and negative inputs. Obviously, you need to do this if youwant to measure the voltage difference between two points that are each at a non-zero voltage with respectto the A/D ground. Less obviously, the ground of your circuit is slightly different from the ground of theA/D because there is a very long path between them and thus a small resistance. So any current flowingwill lead to a shift in grounds. For these and other reasons, we will use differential inputs routinely in thecourse. Note that the USB-6009 has eight inputs when configured for single-ended operation but only fourwhen configured for differential input.

Page 11: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

1.3. EXPERIMENTS 11

• Use cursors (Graph/ Show Info) to measure amplitude and period. You can alsodrag the waveform to get an offset. Convert the measured period into a frequencyfor the waveform. Compare the values you observe with your intended settings.Use the WaveStats operation to get amplitude, too.

In the next two exercises, set the DAQ to the convenient sampling rate of 10 kHzand have it read in 100 points (and store them to a file). (Usually, we will sampleat the maximum rate, 48 kHz, but using 10 kHz will make these exercises easier tounderstand.) Connect the function generator to both the DAQ and the oscilloscope,so that you can compare the two.

4. Explore quantization errors. Set the function generator to a 2 V peak-to-peak (pp)sine wave. (Note that “2 V pp” means that the sine wave goes from +1 V to −1V.) Setthe sine wave frequency to 1 kHz. Start at 2 V p-p and then reduce the amplitude tothe lowest value the function generator will go. Compare what you see in the computerwith what you see on the oscilloscope. Interpret your observations. (See the problembelow.) Record data from the 2 V pp and from the minimum voltage the functiongenerator gives. Notice how the jumps in data (use Igor’s cursors to see the differencein levels easily) occur in “quantized” steps. (You may also want to use the “Cityscape”type of trace. Double-click on the trace to change the trace type. See the first problem,below, for hints on how to account for these steps. How does noise affect the digitizedsignal? How does it affect the analog signal on the oscilloscope?

5. Explore sampling errors. Set the amplitude again to 2 V pp. Progressively increasethe frequency of your sine wave, starting from a low value (say 100 Hz) and recordthe frequency of the sine wave measured by the DAQ. Compare what you see in thecomputer with what you see on the oscilloscope. Interpret your observations. (See theproblem below.) The “sine wave” does not look much like a sine wave for frequenciesthat are greater than about 2 kHz. Why? What does the “sine wave” look like at5 kHz? Why? Why does the waveform at 9 kHz again look pretty close to a sinewave? What happens as you go to frequencies above 10 kHz? Include some waveforms(either Igor plots or hand sketches) in your lab book. Record to disk waveforms of thefollowing frequencies: 100, 1000, 5000, 5000+/-, 10000, 10000+/-, 20000+/-. Here,“5000” means you should try to get as close as you can to that frequency (withinreason), while “5000+/-”means that you should set the frequency close to, but notexactly equal to 5000 Hz. (“Close” is perhaps between 5010 and 5100 Hz.) Try tounderstand, in as quantitative a way as you can, the shapes of these waveforms. Seethe “aliasing” question in the problems, below, for more guidance. Print out graphs ofthese waveforms (as a “Layout” in Igor) and tape or staple them into your lab book.Label them (e.g., “a”, “b”, etc.) and explain them in the lab book.

Page 12: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

12 CHAPTER 1. INTRODUCTION TO COMPUTER-AIDED DATA ACQUISITION

Circuit Out + A/D in +

Single-ended

Circuit Out + A/D in +

Circuit Out - A/D in -

Differential

(a)

(b)

Figure 1.1: Schematic of single and differential input methods.

1.4 “Postlab”

These questions are due Friday, along with your lab notebook that you used for this lab. Dothem in your lab notebook, too. (In the future, we’ll just have prelabs, which will be due atthe start of the lab session, on a separate sheet of paper.)

1. Your data acquisition device (USB-6009) claims a 14-bit resolution.2 If the full rangeof the A/D input is set at its maximum value, ±20 V, what is the voltage step corre-sponding to a 1-bit change? This is the smallest voltage difference that can be resolvedwith a single measurement (on that range). The smallest range is ±1 V. What is thecorresponding quantization step? Please show your work in calculating these numbers.

2. The phenomenon known as aliasing occurs when a high-frequency sine wave is sampledat a frequency that is too low, or, alternatively, for a given sampling rate, aliasing occurswhen you try to measure a sine wave whose frequency is too high. In our lab, with afixed sampling frequency, we encounter the latter situation.

Any sine wave is characterized by just three quantities: its frequency, amplitude, andphase. The first two are fundamental, while the third quantity only makes sense relativeto some external time reference. To “measure” a sine wave, then, is to determine itsamplitude and frequency correctly.3 (We’ll ignore the phase here, which is important

2The term “bit” is short for “binary digit.” Normally, we write out numbers using decimal notation: thereare 10 digits, 0 to 9, with each place representing a power of 10. Thus, “10” means “101”, “100” means“102”, “0.1” means “10−1”, with the dot representing a “decimal point,” and so on. Analogously, binarynotation uses just two digits, 0 and 1, with each place corresponding to a power of 2. Thus, “10” means “21”(2), “100” means “22” (4), “0.1” means 2−1 (0.5), with the dot representing a “binary point,” and so on.

3Why do we focus on sine waves? It turns out that any signal (function of time) V (t) can be representedas a sum of sine waves. If we know what happens when we measure a sine wave of arbitrary frequency, wecan understand what will be the effect on an arbitrary signal V (t).

Page 13: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

1.4. “POSTLAB” 13

when comparing two different sine waves.) Our goal here is to understand what happenswhen you sample at a rate fs a sine wave whose frequency and amplitude are f andA, respectively. In particular, if f < fs/2 (the “Nyquist frequency”), one can infer fand A correctly, but if f > fs/2, the frequency one infers will be incorrect.

Towards that end, think of a few situations. First, if f fs, it is pretty clear thatthe representation will be accurate. On the other hand, if f = fs, then clearly yousample the waveform at the same phase each time and will get a constant result (DC,or zero frequency). If f ≈ fs, the result will look like a low-frequency wave. Using thiskind of reasoning, aided by some hand or computer sketches, plot the function fm vs.f , where fm is the frequency of the sine wave you infer and f is the actual frequency.Label the f -axis in units of fs/2 – i.e., fs/2, fs, 3fs/2, etc.

One subtle point is that the frequency should be inferred from the fast oscillations ofthe wave and not from any slow beatings in amplitude you may observe. The reasonfor this is that you know that the original wave is a sine wave. For example, if you picka frequency near fs/2, you will see beats in the amplitude and can infer that you havea sine wave whose amplitude is the maximum amplitude of the beats. Of course, youneed to sample for a long-enough time so that you see the longest period of any beatingthat may occur. You might worry that if your sine wave frequency is rationally relatedto fs (i.e., equal to exactly fs, fs/2, etc.) that you will never see the full amplitude.Although this is true, it is an artificial situation. In real life, there is no general relationbetween the signals you measure and your sampling rate. (The frequency of one is justwhat’s out there in Nature; the frequency of the other depends on how you set up yourDAQ.) Thus, if you pick a frequency at random, there is essentially no chance that itwill have a rational relationship with fs.

To summarize, in this problem, you should do the following:

(a) Explain why the maximum frequency that may be measured accurately is fs/2.

(b) Plot fm vs. f (for frequencies up to and then greater than fs).

(c) As a practical matter, if you want your measured (or “sampled” waveform) tolook like “reasonable close” to the original sine wave – i.e., to have the correctfrequency and no major beating effects – what should its maximum frequency berelative to fs? (In our boards, the maximum fs is 48 kHz.)

Thus, for a given sampling rate fs, there are three regimes: the “low-frequency” regime,where the measured waveform closely resembles the analog signal; the intermediate-frequency” regime, where the measured waveform looks complicated but you can workout what the original amplitude and frequency are; and the “high-frequency” regime,where you will get the wrong answer for the frequency. This latter regime is the onewhere aliasing occurs. Aliasing occurs above a specific frequency (“Nyquist frequency,”=fs/2), while the boundary between the low- and intermediate-frequency regimes ismore subjective. (You are supposed to come up with a criterion as part of this problem.)

Page 14: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

14 CHAPTER 1. INTRODUCTION TO COMPUTER-AIDED DATA ACQUISITION

3. Learning LabVIEW and Igor. In this course, we will be using two different softwarepackages extensively, LabVIEW for data acquisition and Igor for data analysis. Whilethis is not a programming course per se, you will have to become a bit familiar withbasic programming concepts in both packages. LabVIEW may be purchased, in astudent version, for about $100. We have a coursework license for Igor that allows youto install it on a home machine IF you promise to use it only for work related to ourclass. If you like it and want to use it for things unrelated to coursework, they requestthat you get the student version (also about $100.) Because we will be doing prelabassignments and data analysis using Igor, it is best if you can install it on a homemachine. If you do not have anything available, there is limited access to computerseither in the lab room (Surrey) or in the PUML lab (Burnaby). Note that one of theconditions of the coursework license is that all technical support questions about theprogram be addressed to the instructor here, not to the company.

For LabVIEW, you can arrange to have a one-time 3-hour online access. (You needaccess to a PC for this.) There are also training materials available on our coursewebsite. With this in mind,

(a) Download the “Getting Started with LabVIEW” tutorial from the course website.Much of what we do is actually Chapter 4, so you should work quickly throughChapters 1-4 to get a broader overview of LabVIEW. Eventually, you should knowall the material in the tutorial. (There is also a more detailed “LabVIEW in sixhours” tutorial that we will be referring to later in the course.)

(b) Sign up for the “LabVIEW 8 Online Evaluation”. (Go to the company’s website,www.ni.com and type this phrase into their search bar.) Bear in mind that youget only three hours of access.

(c) Install IgorPro on your home machine, if available, and start working your waythrough their Tutorial. Open Igor and select Help / Manual. In the manual,start going through Vol. I, “Getting Started” (aren’t these names original!).Work through I-1, “Introduction to Igor Pro” and, if you have time, you can startgoing through I-2, “Guided Tour of Igor Pro.”

As we go through the course, you should come back to these tutorials to learn eachprogram better. Of course, both programs have full context-dependent on-line helpavailable, too. Use it for specific problems that come up and to get help on a particularfunction, operation, etc.

Page 15: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

Chapter 2

DC Impedances and Measurements

2.1 Goals

• Review DC impedance, voltage dividers.

• Notion of Thevenin equivalent circuit.

• Measure input impedance to analog-to-digital converter (A/D) of the data acquisitiondevice (DAQ).

• Learn how to deal with finite input impedances.

In this lab, we begin by reviewing some notions of resistance, or “DC impedance.” See theReference Manual for more discussion. We then explore the idea that every voltage source– indeed, every circuit – can be viewed as being an ideal source in series with an internal(“Thevenin equivalent”) resistance. The same notion applies to voltmeters, in particularto the voltage input to our DAQ. We use a voltage-divider circuit to measure this “inputimpedance.” This gives a worrying result: because the input impedance to our DAQ turnsout to be rather low, we will get incorrect values when measuring voltages in circuits withquite ordinary equivalent resistances. We explore several strategies on how to deal withthis problem. By the end of this lab (in conjunction with what you learned last week),you should understand the basic requirements – signal conditioning, sampling rate, andquantization depth – for using an A/D converter to accurately capture an analog signal intoa computer.

2.2 Prelab Questions

1. Show that the voltage output Vout of a voltage divider circuit (Fig. 2.1) is given by

Vout = VinR2

R1 + R2

. (2.1)

Plot Vout vs. R1 for fixed Vin, R2.

15

Page 16: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

16 CHAPTER 2. DC IMPEDANCES AND MEASUREMENTS

Power

Supply

Vin+

Vin-

Vmeas+

Vmeas-

R1

R2

Figure 2.1: Voltage-divider circuit. The measured voltage is Vout = Vmeas+ − Vmeas−

2. Find the Thevenin equivalent of the circuit in Fig. 2.2.

Vout

33 k

22 k

DCpowersupply12 V

+

-

10 k

Figure 2.2: Another voltage-divider circuit.

3. You are to measure the voltage at the output of a circuit whose Thevenin equivalentresistance is RTh using a voltmeter whose input impedance is Rinp. See Fig. 10.1. Showthat what you will measure should be described by

Vout = Vin1

1 + RTh

Rinp

. (2.2)

In other words, the finite input impedance biases the measurement of the voltage.What happens when Rinp RTh?

2.3 Experiments

1. Using a nominal 100 Ω resistor, test Ohm’s Law. Use the DC power supply (and itsmeter) to set a current and the digital multimeter (DMM) to measure the resultingvoltage across the resistor. Record your measured V − I pairs in Igor and display as agraph. Using the cursors (or by printing and measuring by hand), estimate the slopeand compare to the nominal value you used.

Page 17: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

2.3. EXPERIMENTS 17

+in +

!in !

RinpVTh

RThV

differential

Input of A/D

Figure 2.3: Measuring input impedance. Here, V is the voltage measured by the analog-to-digital converter, which has an input impedance Rinp. The three dots denote a wireconnection that you are expected to make.

2. LabVIEW programming task: Display a continuous series of voltages, with a settableupdate rate. In effect, we want our DAQ to act like the voltmeter we used in thefirst experiment above. We can do this with a VI only slightly more complicated thanlast time. Starting from your VI from the first lab, reconfigure the DAQassistant tomake just a single measurement (on demand). Then add an overall While loop, witha suitable time delay. (This will be covered in the lecture.) Instead of writing thevoltage to a file, send it to an indicator. The numerical one is the most useful, but youcan add a meter or gauge, too. (There’s no real need for a waveform graph.)

3. Wire up a voltage divider, using R2 = 100 Ω. Follow the schema in Fig. 2.1, connectingthe outputs to the plus and minus input of the DAQ. Use the VI you just wrote todisplay the voltage. You can record the voltage measurements by hand in your lab book.For R1, use the following nominal values: 10, 20, 50, 100, 200, 500, 1000 Ω. MeasureVout vs. R1 for fixed Vin. In Igor, plot your data and the function corresponding towhat you expect based on Vin, R1, and the expected theoretical relationship (Eq. 2.1).(See the Igor tutorial on how to define a function.)

4. The goal of this next part is to see the effects of a finite input impedance on voltagemeasurements. Any time you measure a voltage, you do so on a circuit that can beviewed as an ideal voltage source and some Thevenin equivalent resistance in series. Onthe other hand, the voltmeter used to make the measurement (here the A/D converter)also may be viewed as a finite impedance in parallel with an ideal voltmeter. Thecombined situation is shown in Fig. 10.1. (Cf. the prelab questions, too.) Here, weshall measure Rinp by making a connection with a variable RTh. To do this, use thepower supply as a voltage source and put another resistor R1 on the output. (Thepower supply’s own internal resistance will be in series with this R1, but we will belooking at R1 values that are much larger. Measure VA/D vs. R1 for a variety ofresistors. (Make sure that the resistances you pick for R1 are large enough to see aneffect! The largest value of R1 should be large enough that the measured voltage issignificantly less than the power-supply voltage.) Plot Vout vs. R1 in Igor. Plot theexpected theoretical relation (see Eq. 2.2) in Igor. Try this last plot for different values

Page 18: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

18 CHAPTER 2. DC IMPEDANCES AND MEASUREMENTS

of R1. Choose the value of R∗1 that makes the theoretical curve “fit” the experimental

data the best. Show the plot corresponding to your best value. Estimate a reasonableuncertainty by exploring how much you can vary R1 before you see that the fit is clearlyworse than your best value. If that variation is δR, overlay your theoretical curves onthe same graph for R∗

1 − δR and R∗1 + δR. (Thus, you should have a graph that has

data points, shown as individual markers, a solid line corresponding to your best fit,and two dashed lines, one on either side, that show “confidence intervals” where youthink the correct value of R1 really lies.) To show that the “problem” lies with the useof the A/D converter as a voltmeter, record your measurements of Vout vs. R1, alsousing the DMM (which has a much higher input impedance) in place of the DAQ andthe same values of R1. (You can do this at the same time as the signal goes into theDAQ, to save time.) Plot Vout vs. R1 for fixed Vin. Using the equivalent circuit

It’s beginning to look like our DAQ, the USB-6009, may be problematic for measuringvoltages. It has analog inputs, but when you connect up to circuits of ordinary impedances(∼ 10 kΩ), there are already significant errors. When we use a better voltmeter (the DMM)with much higher impedance, everything is ok, but we would like the voltages we measureusing a computer to be trustworthy, too. What to do? There are several possible courses ofaction:

1. Buy a better DAQ. The USB-6009 is a bottom-of-the line DAQ. Pay more money, andyou get better performance, including a higher input impedance.

2. Buffer. There is a fancy “electronic” solution that involves an active (powered) elec-tronic circuit known as a buffer. The buffer is a small power booster. In practicalterms, it is a black box, whose input looks like a very high input impedance to thecircuit you are trying to measure. The output of the buffer, which goes to the DAQ,has a low impedance. Thus, you get the best of both worlds, at the cost of morecomplexity.

3. Avoid. If you can arrange to always measure circuits with low-enough impedance, theloading from the DAQ will not lead to appreciable error.

4. Ignore. Sometimes, there will be an appreciable error, but we don’t care. For example,if all you need to do is measure a sine wave’s frequency, you can tolerate amplitudeerrors.

5. Compensate. Using your measured input impedance, figure out a way to estimate whatthe “ideal” measurement should be. In other words, you take your measured voltageand “correct it.”

Any of these five solutions can work. Regarding the first solution, we obviously don’texpect you to dig deep into your own pockets, but “in the real world,” one should always

Page 19: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

2.3. EXPERIMENTS 19

keep in mind that it may be better to pay more for better equipment than lose time in com-pensating for the flaws of cheaper equipment. In the interests of furthering your education,we decided not to take the easy way out, and so we need to proceed to other solutions. Thesecond solution requires that you know some electronics. Our third-year electronics courseteaches how to make and use such circuits. Mostly we will design the labs so that the circuitsyou measure will have low input impedances – i.e., we avoid the problem. Other times, wewill ignore it. Occasionally, we need to compensate. To get a feel for how that works, do thefollowing:

Make up another voltage divider. This time, let R1 be a 100 kΩ resistor, and let R2

be 10, 20, 50, 100, 200, 500 kΩ, and 1, 2, and 5 MΩ (or values close to these). Plot Vout vs.R1 for fixed Vin. From the Thevenin-equivalent circuit that includes the input impedanceof the DAQ, correct your measured Vout to the equivalent reading you would have measuredwith an ideal DAQ having infinite input impedance. Add the corrected Vout to your previousplot and, doing a manual “fit” as in the previous section, show that the corrected data givethe expected result for the voltage divider. (Your final plot should have the two data sets –use two different markers – and the overlaid theoretical curve.)

Page 20: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

20 CHAPTER 2. DC IMPEDANCES AND MEASUREMENTS

Page 21: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

Chapter 3

Probability Distributions

3.1 Goals

• Learn the elements of probability theory

• Binomial and Poisson distributions and their applications

• Use of DAQ for counting

• Understand a basic counting experiment (radioactivity)

References

1. Unit 28 on radioactivity (see web site) Make sure you read this! (The first part, pp. 28-1to 28-8, is relevant for this week’s lab.)

2. J. R. Taylor, An Introduction to Error Analysis (University Science Books, 1997).

3. P. R. Bevington and D. K. Robinson, Data Reduction and Error Analysis for thePhysical Sciences (McGraw Hill, 1992).

3.2 Prelab Questions

Read the labscript and do Problems 1 — 9.

Introduction

Probability distributions describe the probability of observing a particular event. Threedistributions play a fundamental role in the analysis of experimental data: the binomialdistribution, the Poisson distribution and the Gaussian Distribution. In this lab we willexplore the binomial and Poisson distributions first by using coins and dice and then bymeasuring the decay of a radioactive sample.

21

Page 22: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

22 CHAPTER 3. PROBABILITY DISTRIBUTIONS

Probability

In order to understand the statistical methods of dealing with random processes and howsome predictability can be garnered from such chance events, we will examine some sim-ple cases involving coin tosses and dice. First we introduce three important properties ofprobability:

1. If you consider two possible events A and B which are mutually exclusive (that is, ifA happens B cannot happen and vice versa) then the probability of either A or Bhappening is the sum of the probabilities of A and B: P (A or B) = P (A)+P (B). Anexample of two such events would be a coin toss where there are two possible events,A =heads or B =tails.

2. The sum of the probabilities of all possible mutually exclusive events of a trial is unity,because one of the events must happen in every trial: P (A) + P (B) + P (C) + ... = 1.In our coin toss example, the coin must turn up either heads or tails.

3. The probability that two independent events will both happen is the product of theprobabilities of the two single events: P (A and B) = P (A) ·P (B). An example of twoindependent events would be two coin tosses.

From these rules we can draw the following conclusions:

• If a trial has n and only n possible different outcomes, and if you know that all ofthe outcomes have equal a priori probabilities of happening, then the probability of agiven outcome must be equal to 1/n.

• If you classify the outcomes of a trial into different classes, and if the number of eventsbelonging to one class is m, the probability that an event belonging to that class willhappen is m/n.

We have to bear in mind that the concept of “equal probability” of events has to bederived from experience. Once we have classified by experience all the possible different andmutually exclusive events in such a manner that they have equal a priori probability, we canapply the rules of probabilities for detailed calculations. The key problem, therefore, is toidentify which events have equal a priori probability. It requires considerable care to avoidmistakes. For example, if you toss two coins, you might argue that there are three possibleoutcomes: two heads, two tails, or one head and one tail. If you assume that each of theseprobabilities are equally likely then the predicted probability would be 1/3 each. Experienceshows this to be wrong. The mistake is in having assumed two different events are only oneevent: heads followed by tails, and tails followed by heads. This nuance will be clarified byworking out in detail the case of tossing four coins.

Page 23: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

3.2. PRELAB QUESTIONS 23

Example 1: Four coins

Toss four coins. Each coin has a 50% probability of turning up heads and a 50% probabilityof turning up tails. (This seems logical, but it is an assumption that should be justified byexperience.) Let p represent the probability of heads and q = 1 − p that of tails: p = 0.5,q = 0.5.

The probability of no heads in a toss is the probability that all four coins turn up tailssimultaneously:

(probability coin A is tails and coin B is tails and coin C is tails and coin D istails) = (probability coin A is tails) x (probability coin B is tails) x (probabilitycoin C is tails) x (probability coin D is tails).

There are 16 different ways the toss can turn out if we can distinguish which coin iswhich. Each of the 16 ways is equally likely and only 1 of those sixteen ways is all tails. LetPo represent the probability of none of the four coins turning up heads.

Po = q4

= 0.5× 0.5× 0.5× 0.5

= 1/16

There are four ways that one coin can turn up heads. Coin A can be heads, coin Bcould be heads, coin C could be heads or coin D could be heads. Each one of these has aprobability of p q3 = 1/16. Thus there are four chances out of 16 for one head if we don’tcare which coin is heads:

P1 = p q3 + qpq2 + q2pq + q3p

= 4× (1/16)

= 1/4

The probability that both coins of a specific pair are heads and the other two are tailsis p2q2. To calculate the probability that any two coins be heads we have to figure out howmany different pairs there are. How many different ways can the four coins turn up twoheads and two tails? Consider choosing the two coins that are to be heads. There are fourways of choosing the first coin and three ways of choosing the second so that there are 4× 3or 12 ways of choosing two from four (“four choose two or 4C2”). But half of these 12 arereally the same two coins that have been chosen in a different order. For example if we labelthe coins ABCD we can choose two in the following possible ways:

Page 24: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

24 CHAPTER 3. PROBABILITY DISTRIBUTIONS

ABACADBA (same as AB)BCBDCA (same as AC)CB (same as BC)CDDA (same as AD)DB (same as BD)DC (same as CD)

Those cases where the same two coins have been chosen but in a different order must beeliminated from the count. The ways of choosing two different coins from among four areshown in Fig. 3.1.

Figure 3.1: Choosing two coins from four.

Thus you can see that the total number is 4×32

= 6 .You should be able to convince yourself that the number of different ways r things can

be chosen from m, when the order is unimportant, is

m!

(m− r)!r!

The logic in this formula is as follows: the number of ways one can choose r from m withoutregard to duplication is m(m− 1)(m− 2)...(m− r + 1) which is m!

(m−r)!. This quantity must

be divided by r! to account for duplicates consisting of the same coins chosen in a differentorder. This is the number of different possible combinations of m items taken r at a time.

Now we are ready to write down an expression for the probability distribution thatdescribes the likelihood of r events (e.g. heads) occurring in a total of m events (e.g. coinflips) where the probability of an r-event occurring is p while the probability of it notoccurring is (1 − p). Since the individual events occur independently, the probability of asubset of r events amongst many m is the product of individual probabilities. If r occur,then m−r don’t and the probability is pr(1−p)m−r. For the total probability of a particularevent occurring (e.g. 2 heads), we multiply the probability that the event occurs by thenumber of ways that event can occur. The complete formula for the probability distribution

Page 25: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

3.2. PRELAB QUESTIONS 25

is then given by

Pr =m!

(m− r)!r!(1− p)m−rpr . (3.1)

This distribution is called the binomial distribution. It describes the probability that r eventsoccur among a total of m independent events. Note that it is a discrete distribution; it isdefined only at integral values of the variable r.

We can now use Eq. 3.1 to calculate the probability of getting two heads among fourcoins. Remember, for the coin toss, the number of events is r = 2 out of a total of m = 4coins and the probability of each event is p = 1/2. Then

P2 =4!

2!2!

(1− 1

2

)2 (1

2

)2

=3

8.

The other values of Pr can be obtained similarly.

Problem 1: Use Eq. 3.1 to complete column 2 of the following table. Plot the histogramof values.

r Pr rPr (r − r)2Pr

01234sum

Recall that the total probability of all possible events must sum to unity:

4∑r=0

Pr = 1 . (3.2)

Problem 2: Verify that this sum does work out to unity. Sum the entries of the secondcolumn and write your result in the last row of the table.

The third column of the table allows you to work out the average number of heads in agiven toss. Given the probabilities Pr for each different outcome, the average of r can becalculated using the following simple formula:

r =m∑

r=0

rPr . (3.3)

Using this definition and Eq. 3.1 we expect that, for a binomial distribution, r = m p.Problem 3: Fill in the third column and add up the terms. Is the average reasonable?

Page 26: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

26 CHAPTER 3. PROBABILITY DISTRIBUTIONS

The fourth column allows you to work out the variance. Given the probabilities Pr foreach different outcome, the variance can be calculated using the following simple formula:

σ2 =m∑

r=0

(r − r)2Pr . (3.4)

For a binomial distribution, σ2 = m p (1− p).Problem 4: Fill in column 4. Is the variance reasonable?

Note: If one expands (p+q)4 one gets p4+4p3q+6p2q2+4pq3+q4. Each term of this expansion corresponds to oneof the probabilities in Table I. This “binomial expansion”was described by Newton. The factors of each term canbe figured out using “Pascal’s Triangle” that was pro-mulgated by Pascal. The sides of Pascal’s triangle are1’s. Interior numbers are obtained by summing the twonumbers to the left and right above its position.

11 1

1 2 11 3 3 1

1 4 6 4 1

Example 2: Twelve six-sided dice

Here we will let twelve six-sided dice represent twelve total events. After a roll of the dice,a die that turns up a “snake eye,”

,

can be our choice of event that we want to keep track of. The probability of this eventoccurring is p = 1/6. (Why?)

Problem 5: Work out the probability of rolling r = 0 ... 12 snake eyes and complete a tablesimilar to the one you used in Problem 2. Plot a histogram of values. Also verify that thesum of the probabilities is unity, and that the average number of decays and the varianceare reasonable.

Example 3: Sixteen eight-sided dice

The event of interest is again rolling a “snake eye.”

Problem 6: What is m and p for this example? Work out Pr for r = 0 ... 16 and completea table similar to that used in Problem 2. Plot a histogram of values. Also verify that thesum of the probabilities is unity, and that the average number of decays and the varianceare reasonable.

Page 27: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

3.2. PRELAB QUESTIONS 27

Example 4: The limit of a large number of atoms each having a small probabilityof decay

The decay of radioactive atoms provides another convenient source of random events tohelp us explore how we can use statistics to deal with randomness. A sample of radioactivematerial contains a large number of atoms. Many of these atoms are unstable and willtransform to another element or isotope by emitting a photon, electron or alpha particle.We will assume that, once an unstable ”parent” decays, the resulting ”daughter” is stableand can emit no more particles. In more complicated cases, the daughter might be unstableas well but we will not deal with that situation now.

Even though the time at which any particular atom will decay is unknown, there is someregularity in the process that we can discover by looking at the average behavior of a largenumber of atoms over a long time. For example, the fraction of unstable atoms that decaysin a certain time period, for example one second, fluctuates around a well-defined averagevalue.

Two characteristics are important in understanding radioactive decay. First, the proba-bility per unit time that an undecayed atom will decay within an infinitesimal time interval∆t is a constant:

Probability of decay in ∆t

∆t→ a as ∆t → 0

where a is the probability per unit time of observing a decay. Second, the atoms are inde-pendent; the state of any atom does not affect another.

We can use the concepts developed in the previous sections to describe the probability ofradioactive decay occurring in a number of unstable atoms by realizing that each radioactiveatom is equivalent to a coin or die, that the passing of a one-second time interval is equivalentto each toss of four coins or twelve dice, and decay of an atom is equivalent to a coin turningup heads or a die turning up a ’snake eye’.

The case of radioactive decay is of course different from that of the coin and dice exper-iments we have been discussing. In a real radioactive sample there are a huge number ofatoms, but each one has a small probability of decay, i.e. m →∞, p → 0, but their productremains finite. In this case it is possible to make some approximations that simplify Eq. 3.1.

1. for r m

m!

(m− r)!= m(m− 1)...(m− r + 1)

' mr

Problem 7: Work out how much difference this approximation makes for 100!/95!.

2. for small p

(1− p) ' e−p

Page 28: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

28 CHAPTER 3. PROBABILITY DISTRIBUTIONS

This comes from the Taylor expansion of the exponential function. When p is much lessthan unity, the squared, cubic and higher order terms of the expansion are negligible.Thus

(1− p)m−r ' e−p(m−r)

= e−pmepr

' e−pm · 1= e−pm .

Problem 8: Work out how much percentage difference this approximation makes forp = 0.1, m = 100, and r = 5.

Substituting these results into Eq. 3.1, we find

Pr =mre−pmpr

r!. (3.5)

Now define µ = pm , the average number of radioactive decays in each time interval. Inthis limit, the binomial distribution reduces to the following form:

Pr ' µr

r!e−µ . (3.6)

This distribution is called the Poisson distribution. Recall that Pr is the probability of rcounts per time interval and µ is the average number of counts per time interval. We havejust shown that the Poisson distribution is the limit of the binomial distribution in caseswhere m is large and p is small. This is the case in most radioactive samples. Therefore, thePoisson distribution is a good approximation for analyzing counts from a radioactive sample.

For a series of events described by the Poisson distribution, the average expected valuecalculated from Eq. 3.3 is r = µ and the variance, calculated from Eq. 3.4, is σ2 = µ.

Problem 9: As an exercise, it is interesting to see how closely the Poisson distributionapproximates the binomial distribution for the case of 16 eight-sided dice being rolled witha decay probability of 1/8 each time. Copy the following table and fill it in.

Page 29: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

3.2. PRELAB QUESTIONS 29

r Pr (binomial) Pr (Poisson)012345678910111213141516sum

The similarity between the Poisson and binomial distributions, even in this case which isfar from the limit where the Poisson distribution strictly applies, underlines why it will bedifficult to distinguish the three boxes in the group experiment you will do (Expt. 1). Therandomness of the finite set of results in each case masks the small distinctions among thedistributions.

Note: Both µr and r! are large even though their ratio might be relatively small.In general, if you wish to evaluate such expressions numerically, it is better tofind a form that does not involve the ratio of two large numbers that evaluates toa small number. Thus, one further approximation is useful. For µ 1, one canshow that the Poisson distribution approaches a Gaussian distribution of meanµ and standard deviation

√µ. (See the µ = 10 curves on Fig. 3.2.) Thus, in this

limit,

Pr ' 1√2πµ

e−(r−µ)2

2µ (3.7)

Page 30: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

30 CHAPTER 3. PROBABILITY DISTRIBUTIONS

0.4

0.3

0.2

0.1

0.0

Pro

babili

ty, P

r

20151050

Observed counts, r

µ=1

µ=3 µ=10 Gaussian

Figure 3.2: For µ 1, the Poisson distribution approaches a Gaussian distribution of meanµ and standard deviation

õ.

3.3 Experiments

These experiments are heavily based on the prelab discussion and exercises. Make sure thatyou have done those before class!

1. Identifying Parent Distributions from Data (Group Experiment)

The problem of discerning the parent distribution behind experimental results is keyin many scientific experiments; testing the effectiveness of medical treatments is oneexample. It is useful to illustrate the difficulties in this type of analysis with simplecases involving dice and radioactive decay before tackling the much more complexproblems that arise in other situations.

We will generate three histograms by shaking three boxes of dice or coins and countingthe number of events. One box has four coins, another has 12 six-sided dice and thethird has 16 eight-sided dice.1 The class leader will shake each box and announcehow many events (heads for the coins and snake-eyes for the dice) there are in eachbox. This will be repeated 10 times. Each student will keep track of the number ofcounts on a histogram by marking an X in the appropriate column as the number isannounced. You can use the tables in the Appendix (3.4) of this labscript and thenput the page into your notebook. You will not be told what each box contains. Afterthe histograms are complete, you will analyze the histograms and guess which parentpopulation generated each histogram. Think of this as making your case (to the reader)that Box A has the coins, B has the 6-sided dice, and C the eight-sided (or whateveryou conclude for A, B, and C). You make your case by presenting evidence, which canconsist of measured histograms, estimates of the average and standard deviations, and

1In practice, we will just use one box and separate out the coins and different dice.

Page 31: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

3.3. EXPERIMENTS 31

the comparison of these with your expectations, based on the binomial distribution.As part of your analysis, you will plot the expected frequency as a function of numberof decays on each histogram. The expected frequency is ten times the probabilitycalculated from the binomial distribution as entered in the tables you prepared forExamples 1-3. (Why?)

Page 32: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

32 CHAPTER 3. PROBABILITY DISTRIBUTIONS

2. Programming Exercise (LabVIEW, individual): Write a LabVIEW program toread the number of counts in a user-settable time interval T . The basic idea is a simplemodification of the VI you wrote last week. Here, instead of reading an analog voltage,we read the timer. Do the following:

(a) Go into the DAQ assistant and reconfigure your DAQ to read the counter (“ondemand” and using the falling edge).

(b) Add a “Write LabVIEW measurement” Express VI to the output of the DAQmeasurement. (Keep the numerical indicator you already have.) Configure theExpress VI to append the measurement to the previously created file. You mayalso want to make the file name a control, rather than something set in theconfiguration dialog, so that you can give each experiment a different file name.(Otherwise, you have to delete the file each time. Why?)

(c) As written, the program will loop until you press the stop button. There is anotherkind of loop, the For loop, which executes a set number of times. Change yourWhile loop into a For loop. (Right-clicking the While loop graphic gives aquick way to do this. Or you can delete the loop and replace it with a new one.)Attach a control to N , the number of times the loop executes.

(d) Test the program by having the function generator output a square wave (say of1 kHz frequency). You will use the counter input of the DAQ to record the data.This is a digital input: a signal near 0 V is recorded directly as a “0” and a signalnear 5 V is recorded directly as a “1”. These inputs are qualitatively differentfrom the analog inputs we have explored in previous labs. Because the counterwants a “TTL” signal, an event should go roughly from 0 to 5 V. Therefore,adjust your peak-to-peak amplitude of the square wave to be about 5 V and usethe offset to make sure it goes from 0 to 5 V. Remember to connect the functiongenerator signal into the counter input (PFI0 and Ground – pins 29 and 32) andNOT to an analog input!

Note any anomalies in the counts you measure. What happens at different fre-quencies (e.g., 100 Hz and 10 kHz?)

(e) Note that the first interval you measure will be incorrect, because the first timeyou write to file you have to create the file, which takes some time. Thus, youshould always ignore this interval.

3. Programming Exercise (Igor, group): The LabVIEW VI you just wrote writesto disk the total counts as measured at (approximately) equal time intervals. We areinterested in the number of counts in the time interval. Thus, it is necessary to calculatethe difference in the total counts as measured at the end and at the beginning of atime interval. In class, we will go over a very simple Igor function to do this. (Lateron, you will have to write some simple programs of your own.)

Page 33: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

3.3. EXPERIMENTS 33

4. Radioactive Decay Counting

In this experiment, you will use the Radiation Alert Monitor 4 Geiger counter tomeasure the number of counts from the radioactive source issued to you. The sampleemits particles in all directions. Only a fraction of the emitted particles are detectedbecause of the finite size of the detector’s window and its distance from the sample.Therefore, when you do these experiments, you must be sure that the sample anddetector are always at the same distance from each other and have the same relativeorientation.

The Geiger counter puts out “TTL” pulses that go from 0V to 5V for a duration τ ofseveral nanoseconds (10−9s, abbreviated as “ns”). See Fig. 3.3. The pulses arrive atirregular intervals, with a separation in time of T1, T2, etc. The idea is to get the DAQto count how many pulses occur in a given time interval T .

0 V

5 V

!

T1

T2

Figure 3.3: Schematic of a TTL pulse of duration τ with time intervals of T1, T2, etc. betweensuccessive pulses.

• Read the safety notice on handling radioactive sources.

• Connect the Radiation Monitor to the counter input of the DAQ.

• Turn the detector on so that it emits an audible click as it detects particles.

• Adjust the sample-detector distance and orientation so that 20 to 50 counts arereceived each second.

• Record the number of counts obtained in a one-second interval using the VI youjust wrote. (Set the Loop number, N , to 3. As explained above, the first intervalis bad. Just calculate the difference in the second interval by hand or with acalculator.) Write that number in a table similar to the one below in your labbook.

• Try to determine whether a piece of paper absorbs any of the radiation emitted.Fold a piece of paper (use ordinary laser-printer paper, not anything thicker) sothat you can stand it up with just one thickness between the sample and thedetector. Again record the number of counts obtained in a one-second interval.

Page 34: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

34 CHAPTER 3. PROBABILITY DISTRIBUTIONS

• Is the number of counts changed by having inserted the paper? If the secondnumber is smaller than the first, is it due to the paper, or is it just a fluke causedby a different random number of detections in the second measured? If it is larger,discuss whether the paper could have enhanced the detection.

• Maintain your sample/detector difference for the next experiment.

Number of counts without paper:Number of counts with paper:

Page 35: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

3.3. EXPERIMENTS 35

5. Analyzing histograms of counts with a Poisson distribution

In order to determine whether the paper made any difference in the last experimentwe must consider the number of counts to be an imperfect estimator of an unknownquantity that we will call the detection rate. The detection rate is Na where N is thetotal number of radioactive atoms and a is the probability per unit time that one ofthose atoms will decay. Each measurement of the detection rate will be different, buttheir values will cluster around a mean, or central, value. Statisticians like to say thateach measurement of such an unknown quantity comes from a “parent distribution”.This parent distribution is fixed: it is a description of the variability observed inindividual measurements. Two important characteristics of any parent distributionare its mean and its width (or standard deviation). In our experiments, we collecta sample of this parent distribution and calculate sample mean and sample standarddeviation.

In comparing data from two different experiments, we would like to know whether themeans of the two parent distributions are different for the two cases. For example,this is how we might determine whether or not the actual detection rate is affectedby inserting a piece of paper. But as we can only estimate the sample means (with afinite amount of data), we need a method to judge the significance of any measureddifference. We can do this by comparing the magnitude of the difference between thesample means with the (estimated) widths of the two sample distributions.

In this experiment, you will repeat your measure of the number of counts many timesand make a histogram of the results in order to get some inkling of what the parentdistribution looks like and to find a way of quantifying its width. We will record theseries of counts to disk using the LabVIEW VI you have written and then make ahistogram in Igor.

Use the same detector/source geometry as used in the previous experiment.

• Record counts for 102 one-second intervals to disk. (This is to get 100 validinterval measurements.)

• Open in Igor, and use the function provided to make a wave of the counts in eachinterval. Delete by hand the two bad data points at the start. (In a Table, selectthe points and Cut [Cntrl-x].)

• Use Igor’s Wavestats operation (see the Analysis menu) to calculate the meanand standard deviation of the data. Also plot a histogram (Analysis/ Histogram...).

• Find the range of count rates around the average that includes 68 of the events,34 below the mean, and 34 above. This will be your “68% confidence interval” fora single measurement. This implies that an interval of this size around the resultsof one trial, such as those in the table you recorded for Experiment 2, has a 68%chance of including the mean of the parent distribution. Compare this range withthe standard deviation, i.e., check that the range [x− s, x + s] on the histogram

Page 36: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

36 CHAPTER 3. PROBABILITY DISTRIBUTIONS

includes roughly 68 of the 100 counting events. This interval is a reasonablecandidate for the error bar on any one of the one-second measurements. Forexample, it could serve as the error bar for the Number of Counts found above.By comparing the differences in the measurements with the size of the error barsone has a rough criterion to decide whether any difference is real or is a statisticalartifact.

Note: Why do we ask for the 68% confidence interval? The width ofa distribution is usually characterized by its standard deviation. Thestandard deviation can be estimated from the data using the formula

s =

√√√√ 1

N − 1

N∑i=1

(xi − x)2 (3.8)

where there are N data points xi and x is their average. The 68% con-fidence interval corresponds roughly to the interval from one standarddeviation below the mean to one standard deviation above the mean.

But we can do much better than this. We can use the mean of the sample of 100trials as a better estimator of the mean count rate then any single measurementand the standard deviation of the mean, or standard error of the mean, as anestimate of our experimental uncertainty.

• Calculate the standard error of the sample mean, sm, for your 100-trial sample.

• Repeat the above experiment with a piece of paper between the sample and thedetector. Record the data from both experiments in a table in your lab notebook.See the sample table below for an example of how your table should look.

100 one-second intervals with paper without paper differenceaverage count rate (per second)standard deviation of the sample(68% confidence interval for asingle measurement)standard deviation of the mean(68% confidence interval forobtaining this mean value)

• Transfer your data to disk and open in Igor. Plot both histograms. Now normalizethem by the number of measurements (to form an estimate of the probabilitydistribution) and superimpose the Poisson distributions that correspond to theaverages you found. (In Igor, there is a built-in function factorial(x) thatsimplifies this. Look it up in the Help. Note that the factorial function is definedonly at integer values. Your wave for the values of the Poisson distribution shouldbe defined only on integers, as well.) On each histogram, show the mean, thestandard deviation, and the standard deviation of the mean. Centre the latter

Page 37: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

3.3. EXPERIMENTS 37

two quantities about the sample mean for each histogram. Note that for a Poissondistribution, we should find σ ≈ √

µ, where µ is the average count rate. Is thistrue for your data?

In Experiment 2, where the counts in a single one-second interval were accumu-lated, it was difficult to decide whether the paper made any real difference or not.Now, armed with histograms and your new knowledge of statistics, you should bein a much better position to decide whether the piece of paper actually makes adifference to the mean count rate.

• Measure the difference between the estimators of the means and compare thisto the magnitude of the respective standard errors. Are the means of the twodistributions more than one standard error apart? Estimate a lower bound onthe probability that the paper has an effect on the mean count rate. Justify yourestimate using your data.

By spending a little more time taking data, we can improve the resolution betweenthe two cases. In the next part of the experiment, we will accumulate data inten-second intervals in order to decrease the spread of each distribution.

• With enough data, one does not have to use all of these fancy concepts fromstatistics. Repeat the steps of the previous experiment with and without paper,but this time accumulate data for 100 ten-second intervals instead of 100 one-second intervals. Plot the number histograms, as before, and show that thereis now an obvious separation between the two measurements. Show, too, thatthere is an obvious difference between the means, as judged against the standarddeviations. (Remember that you need 102 measurements to get 100 intervals.)NOTE: This part takes 20 min. Be sure to start it early enough to finishby the end of class!

How do the mean count rates, standard deviations, and standard errors change?If you find that the standard deviation or standard error has decreased, explainwhy this is the case in spite of the fact that, strictly speaking, the number ofmeasurements has not changed (there are still 100 measurements per trial). Canyou explain any changes between the one-second interval histograms and the ten-second interval histograms from the theory?

UG21998-1 - Created NA2003-3 - Revised BJF2005-3 - Revised JB

Page 38: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

38 CHAPTER 3. PROBABILITY DISTRIBUTIONS

(This page intentionally left blank.)

Page 39: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

3.4. APPENDIX A: TABLE FOR EXPERIMENT 1 39

3.4 Appendix A: Table for Experiment 1

Box 1

Number of Decays

Frequency

0 5 10 15 20

0

5

10

Average

Identity

Box 2

Number of Decays

Frequency

0 5 10 15 20

0

5

10

Average

Identity

Box 3

Number of Decays

Frequency

0 5 10 15 20

0

5

10

Average

Identity

Page 40: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

40 CHAPTER 3. PROBABILITY DISTRIBUTIONS

Page 41: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

Chapter 4

Radioactive Decay and IntervalDistributions

4.1 Goals

• Explore radioactive decay.

• Understand interval distribution for a Poisson process.

• Use of DAQ for timing intervals.

References

1. Unit 28 on radioactivity (see web site) Make sure you read this! (The latter part,starting at p. 28-8, is relevant.)

2. J. R. Taylor, An Introduction to Error Analysis (University Science Books, 1997).

3. P. R. Bevington and D. K. Robinson, Data Reduction and Error Analysis for thePhysical Sciences (McGraw Hill, 1992).

4.2 Prelab Questions

Read the labscript and do Problems 1 and 2.

Introduction

These experiments continue our work with probability distributions initiated in the previouslab. We will look at the radioactive decay curve and the distribution of intervals betweenevents using both dice experiments and the decay of two different radioactive sources.

41

Page 42: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

42 CHAPTER 4. RADIOACTIVE DECAY AND INTERVAL DISTRIBUTIONS

4.2.1 The Radioactive Decay Curve

Last week, we looked at fluctuations in the count rate of a radioactive source by measuring,repeatedly, the number of counts in a given time interval (one second, ten seconds, etc.).One assumption that we made implicitly is that the average count rate did not change whilewe did our measurements. Strictly speaking, this cannot be right. The atoms that decayare “removed” from the supply of potential atoms, so that the number of potential decays isalways decreasing. Since the probability for a single atom to decay is constant, the numberof decays per time must always decrease. But if the number of atoms is large (> 1020 forour source that we used in the previous lab), we can ignore the depletion produced by thesmall number of decays we measured. This is what we did last week.

This, week, by contrast, we will look at situations where the number of decays is signifi-cant relative to the number of atoms in the sample. In particular, we will obtain a short-liveddaughter product of radon decay. We will then use this sample to study radioactive decay.

As in the previous lab, we will also model radioactive decay by a series of dice throws.We will repeatedly roll a set of dice. Every time we get a “snake eye” (a one), we will saythat that die has “decayed” and will remove it from the sample. We then count how manydice are left after each round. Before we start, you should be familiar with the followingintroduction to the math of radioactive decay, as described here and in the Unit 28 referencelisted at the beginning of this Chapter.

The Math of Radioactive Decay

Let’s start with No dice and ask how many are left, on average, after a number of throws.The probability of decay at each throw is p. The probability of no decay after one throw is(1− p). Therefore there are, on average, No(1− p) atoms left after one throw. Consider 12six-sided dice where all snake eyes are removed after each throw. After one throw, the average

number left is 12(1− 1

6

)= 10. After two throws, it’s 10

(1− 1

6

)= 12

(1− 1

6

)2= 8.33.

In general, the average number left after t throws is

N(t) = No (1− p)t . (4.1)

Normally, since p is fairly small compared to one and pt is larger than one, we may approx-

imate (1− p)t ∼= (1− p)1p

pt ∼= e−pt. Thus, neglecting the approximation sign,

N(t) = No e−pt , (4.2)

and the number of dice remaining decays exponentially.The number of throws it takes to deplete to half the initial number is called the half-life,

t1/2. In our analogy, each throw represents a time interval, so the half-life normally has unitsof time. The half-life can be expressed in terms of the probability per unit time of decay.Since

N(t1/2)

No

=1

2= e−pt1/2

Page 43: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

4.2. PRELAB QUESTIONS 43

t1/2 = − ln(1/2)

p=

0.694

p(4.3)

So, for the six-sided dice example above, the approximate half-life is 0.693/p = 4.1 throws(recall p = 1/6).

Problem 1

The approximation in Eq. 4.3 assumes p 1. Calculate the exact half-life in the six-sided-dice example given above.

4.2.2 The Interval Distribution

Do you know the story of Schrodinger’s Cat? Erwin Schrodinger, one of the founders ofquantum mechanics, proposed putting a cat in a box in which there was a device that wouldkill the cat upon the detection of a single radioactive decay event. There was a great deal ofceremony about the method of potential execution. The cat would first be put in the box andthe lid fastened securely. Then the electronics would be turned on for a predetermined timeinterval, over which there would be exactly a 50% chance of detecting a radioactive decayevent. Now, before an observer unfastened the lid and peered in, would the cat be alive ordead? (If you think the answer is obvious, then you have yet to be introduced to the subtlephilosophical conundrums of quantum mechanics. And if you think this example proves thecruel inhumanity of physicists, well, all of this is really only intended to be hypothetical – a“Gedanken” experiment.)

Quantum mechanics teaches us that there is no way, even in principle, of determiningwhether a particular cat is alive or dead before making the observation, but we can easilydetermine the probability that the cat lives t seconds after the insertion of the radioactivesample. To do so requires determining the probability distribution of the time intervalsbetween the detection of radioactive decay events.

Imagine that we have a radioactive sample, a detector, and some stopwatches. Over aperiod of time, we detect a series of pulses, each representing one detected event. We cancharacterize the pulse series by the time intervals between events. When a decay is observed,we will start a stopwatch and stop it when the next decay is observed. We will repeat thismany times and plot a histogram of the measured time intervals.

We can derive the expected distribution for the case where the decays occur randomly.Let the decay rate be a (decays per unit time), assumed to be constant with time. Then,if we start observing at t = 0, what is the probability that no decays have occurred before

Page 44: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

44 CHAPTER 4. RADIOACTIVE DECAY AND INTERVAL DISTRIBUTIONS

a later time td? If we slice the time into intervals of ∆t each, then there will be td/∆tintervals before time td. The probability of measuring a decay in each time slice is a∆t. Ifwe assume that the events during any time slice ∆t occur indendently of other events, thenthe probability that a decay has not been measured up to a time td is

Pno decay(t < td) = (1 − a ∆t)td∆t → e−atd ,

as ∆t → 0.The probability that no decay occurs during the time interval from 0 to td and that, in

the time slice ∆t immediately after td, a decay does occur is

p(td)∆t = (e−atd) (a∆t) = ae−atd∆t . (4.4)

The function

p(t; a) =

ae−at for t > 00 for t ≤ 0

(4.5)

is thus the probability distribution function associated with an interval of time t, given thatevents occur at a rate of a per unit time. Eq. 4.5 is known as an exponential distribution.It is a probability density function and has units of probability per unit time. Where doesthe condition p > 0 come from? Well, implicitly, we have been assuming t > 0, since a zeroor negative decay time is not physically possible. Note that Eq. 4.5 is properly normalized:∫∞−∞ p(t; a)dt =

∫∞0 ae−atdt = 1. This means that the probability that the decay time ranges

between 0 and infinity is 1, as it must be.

Note: Recall that the binomial and Poisson distributions were discrete – we canonly have an integral number of “successes” or of counts. In contrast, the intervaldistribution is continuous because t can take on any value.

Some Properties of Probability Density Functions:

Any probability density p(x) must be normalized to unity (this may require multiplying bya suitable constant): ∫ ∞

−∞p(x) dx = 1 .

Note that we have implicitly assumed that x may take on all values (−∞ to +∞). In general,the integral’s limits should be restricted to the range of allowed values of x.

Assuming a normalized probability density function, we can calculate the mean of acontinuous variable x as

〈x〉 =∫ ∞

−∞x p(x) dx .

The variance of the distribution can be calculated as

σ2 = 〈(x− 〈x〉)2〉 = 〈x2〉 − 〈x2〉 =∫ ∞

−∞x2 p(x) dx −

[ ∫ ∞

−∞x p(x) dx

]2.

Problem 2: Calculate the mean and variance of the interval distribution (Eq. 4.5).

Page 45: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

4.3. EXPERIMENTS 45

4.3 Experiments

These experiments will not make sense unless you have read the prelab sections and donethe prelab exercises.

Experiment 1: Decay Experiment Using Dice (Group Experiment)

Repeatedly throw a bunch of six-sided dice; remove the snake eyes after each throw; andkeep track of how many are left each time. The resulting data can be plotted versus thenumber of throws (representing time) to give the decay curve.

• Estimate the half-life of the curve from the graph and use it to estimate p.

• Fit by eye a straight line to ln N(t) vs t and estimate values for No and p and uncer-tainties in these parameters.

(In a few weeks, we will discuss curve fits more systematically to show how one can do abetter analysis than we are currently able to do.)

Experiment 2: Radon Decay (Group Experiment)

Because this part of the experiment will take up the whole class, it will be done as a groupexperiment. Afterwards, you will each analyze the data individually.

Procedure

1. Our “radioactive dust collector” is a vacuum cleaner (shop vac) with a piece of gauzetaped over the intake.

2. At the beginning of class, we start the vacuum cleaner in the basement of the PhysicsDepartment (radon gas seeps from the earth and, being heavy, collects in low basementareas). We will collect dust for the duration of the lecture (≈ 50 min.). At the sametime, we will also do a “control experiment,” where we set up another shop vac onthe 9000 level (next to our room). If the radioactivity we are seeing is produced bysomething associated with gas seeping from the earth into our building, we wouldexpect to see fewer counts in the dust collected from higher floors.

3. We set up two Geiger counters without any source and start logging, also at thebeginning of the lecture. We will set the counter to run continuously (i.e., using aWhile loop rather than a For loop), with a count interval of 1 minute, using the VIfrom last week. Since each DAQ has only one counter, we will connect two DAQs to asingle computer. Because each DAQ is identified by an individual serial number whenit’s configured, LabVIEW can run each one independently, at the same time.

Page 46: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

46 CHAPTER 4. RADIOACTIVE DECAY AND INTERVAL DISTRIBUTIONS

4. After the lecture, we retrieve the gauze from the vacuum cleaners, fold them over acouple of times, and tape them over the detector on the Geiger counters. We willproject the data as it comes in onto the screen so everyone can see. We’ll continueto collect data overnight, to make sure that the radioactivity levels decay to theirbackground values. The next morning, we will email the data to you so that you cananalyze it.

For the analysis, input the data into Igor and use the count diff function from last weekto convert the total counts into counts per time interval. Estimate the background countsand subtract this number from your data. Display the log of the corrected data vs. time. Youshould see a roughly straight line (with growing fluctuations for times with fewer counts).Let us then make the hypothesis that we are observing a single substance, with some half-lifethat we would like to estimate from our data. Using our “curve-fitting by hand” methods,estimate the best slope and hence estimate the half-life of the unknown substance that isproducing the radioactivity.

You may find that some of your “corrected” data are negative. Think about why thishappens and figure out a reasonable way to proceed in your data analysis. In your labnotebook, explain and justify the procedure you use. (Later on, when we return to the dataanalysis of this lab, we will see that subtracting the background isn’t really the right thingto do, and the problem of what to do with the negative numbers is just a symptom of this.But it’s good enough for now.)

Throughout your analysis, please record all intermediate and final data in your lab note-book either in a table or as a histogram. (You can print out tables, if needed, from Igor.)Label each such data record and explain the steps used to obtain it from the previous one.

Compare your experimental results with the known half-lives of Radon-222 and its daugh-ters Polonium-218, Lead-214, and Bismuth-214. Can you determine which of these materialsproduced the decays you observed? (Hint: something tricky is going on. Be careful! We willreturn to the data analysis in a few weeks, once we have discussed how to do real curve fits.Keep your data!)

Experiment 3: Measuring the Interval Distribution for Radioactive Decay

In this experiment, you will examine the interval distribution for a radioactive source. Wewill use one of the longer-lived sources like the ones you used in the previous lab. Tomeasure intervals, we need to modify our data collection procedure to measure the elapsedtime between successive pulses from the Geiger counter. To do this with the USB-6009requires some trickiness. Our strategy will be to use the VI we wrote previously, but now weread the counter as quickly as possible so that we typically get either 0 or 1 counts occurringin that interval. We record to disk as before. It is probably more convenient here to convertthe For loop back to a While loop and just stop the VI manually when you get “enough”counts. (You should both play around empirically and also think about how many countsare “enough.” In your lab book, discuss your choice of the number of counts.)

Page 47: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

4.3. EXPERIMENTS 47

Our tests show that a loop time of 20 ms is about as fast as one can go and havereasonably reliable timing, using the LabVIEW write file VI inside the loop (as we did lasttime). A better but more complicated technique, which we won’t use here, would be to storethe counts in an array and write them only at the end of the experiment. In any case, here,you should set your time per loop to be 20 ms and keep the file writing within the loop(using append). This means that to avoid having many intervals where two or more countsare recorded, we have to avoid high count rates. An average count rate of about 10 Hz,(measured using the VI you wrote last week) is reasonable. (After doing the lab, you shouldbe able to comment as to why 10 Hz is reasonable but 50 Hz – which would correspond tohaving on average 1 count per loop – is not.)

To make sure that everything is correct, note that for your data, in most periods, therewill be no counts, and the total will be the same as the previous period. Occasionally, therewill be a single count (and even more rarely two counts). Thus, the data will be a columnof numbers that looks like ... 137, 137, 137, 138, 138, 139, 139, 139, 139, 141, 141, ... wherethe numbers are the total number of counts recorded up to that time interval.

• Read the supplied data file into Igor. Since we haven’t done much Igor programmingyet, we will go over in class a function (counts2intervals) that takes the series ofcounts and converts it into a series of intervals.

• Make a histogram of the interval times.

• Use Eqn. 4.5 to obtain two estimates of a, the probability per unit time of measuringan event. The first estimate – call it a1 – is the intercept on the log plot. The secondestimate – call it a2 – is the slope on the log plot.

Are the two estimates a1 and a2 consistent within uncertainties? Be careful in your choiceof uncertainties. (Make sure you understand why the two values of a should be the same.Discuss any discrepancies.)

Here’s one subtle effect to think about. The Igor analysis program, counts2intervals,which we discussed in class, works by finding the places where the count increment function“passes through” a value of 1. This is the right thing to do when the count increments byone, Is it the right thing to do when the count increments by 2? By more than 2? Why?What are the implications of this for the interval histogram you have accumulated? Thinkabout what you might do in your experiment to minimize any concerns you have. Whateveryou decide to do, discuss and justify your procedure in your lab book. (To see whether youhave this problem, just graph the wave that records counts/interval.)

Here’s another subtle effect: When you look at your interval histogram, the short timeintervals will have many more counts than the long time intervals. Now the value of ahistogram bin is itself a random variable. (Each time we do the experiment, we’ll get adifferent result.) Because the data points come randomly, the process of building up ahistogram is also a Poisson process. This means that if a bin has a value of N counts,we expect that the standard deviation is

√N . This means that the relative uncertainty is

Page 48: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

48 CHAPTER 4. RADIOACTIVE DECAY AND INTERVAL DISTRIBUTIONS

(error/count) =√

N/N = 1/√

N and, thus, that the relative error is smaller for bins withlarger counts. As a result, when you look for your best curve through the interval distributionhistogram, you should put more weight on the bins with larger numbers of counts. Thatis, you should make sure that your curve passes near those points, while if there are binswith a small number of counts (0, 1, 2, etc.), you should not worry as much how close thecurve passes to them. Later in the course, we’ll see how to be more systematic about howto “weight” points according to their uncertainty in a curve fit.

4.4 A more sophisticated analysis of radon decay

In Expt. 2, we analyzed the radon decay curve as a single decay process (a single exponential).For the pre-lab of Week 8 (Mechanical Resonance, part 2) we return to the analysis of thisdata:

Re-examine your data from the radon-decay experiment and do a least-squares curve fitto the data with one exponential on a constant background. (Use Igor’s built-in function,exp, in the curve-fit dialogue.) Note the handout, which shows that the sum of two Poissonprocesses (e.g., background and signal) is again a Poisson process, whose mean is the sum ofthe mean values of the background and signal. This means that you should use the squareroot of the number of counts as your error bar and weight for the fit. You should be ableto show that you get a statistically good fit. (Recall from our discussion – c.f., Taylor, Ch.12, too – that χ2 should be roughly Gaussian, with mean equal to the number of “degreesof freedom” N – the number of data points minus the number of free fit parameters – andstandard deviation equal to

√2N . This approximation is accurate when N

√2N , which,

in practice, occurs for N > 10, roughly.) It turns out that the data analysis of the induced-radioactivity decay experiment is subtle, and the story is an interesting one. Above, youshould have found that the fit was good: i.e., that χ2 is within a standard deviation of theexpected value. But this is not the end of the story. Show that the half-life that you find doesnot match ANY of the materials in the unit on radioactivity that describes the products ofradon decay (which, we hypothesize, is ultimately responsible for the radioactivity we see).Thus, even though our curve fit is a good one, the result is suspicious.

The radioactivity background material we assigned suggests a more sophisticated analy-sis: Let us make the hypothesis that we observe the decays of both Lead-214 and Bismuth-214. The subtle point is that these decays are sequential and not independent. Lead decaysto bismuth, which then decays into polonium (and then very quickly to a different isotope oflead). We should see decays from both the lead-bismuth and bismuth-polonium transitions.

Show that the decays should obey the set of ordinary differential equations,

NL = −λLNL (4.6)

NB = −λBNB − NL ,

where NL is the number of lead atoms, NB the number of bismuth, λL the decay rate ofthe lead, and λB the decay rate of the bismuth. What physical assumptions are we making

Page 49: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

4.4. A MORE SOPHISTICATED ANALYSIS OF RADON DECAY 49

when write Eqs. 4.7? Try to come up with a plausible scenario that leads to these equations.You should ask yourself what it is actually going on when we used the shop-vac and air filter(e.g., radon is a gas, and you would not expect gas to be trapped by an air filter). Thinkabout what happens when you have a material with a very long or a very short half life.What defines long and short?

To solve Eqs. 4.7, we note that the first equation depends only on NL, and is hence easyto solve. Its expression can then be substituted into the second equation.

Explain why the expected count rate is R = −(NL + NB). Show that R is given by

R = Ae−λLt + Be−λBt , (4.7)

where A = λLλB

λB−λLNL(0) and B = −A+λBNB(0). For small initial numbers of bismuth atoms

NB(0), the amplitudes A and B have OPPOSITE signs. Intuitively, this happens becausethe decay of lead “feeds” the number of bismuth atoms, stretching out their decay. Notethat, mathematically, one can find the particular solution to a first-order, inhomogeneousequation by trying a solution of the form, NBp(t) = u(t) e−λBt, where you find u(t) aftersubstituting into the differential equation for NB(t). The general solution is then the sumof the particular solution and the general solution to the homogeneous equation.

All of this is to motivate another functional form for the curve fit, Eq. 4.7 with a constantbackground. Use Igor’s built-in dblexp function. (Be sure to use the graph now feature ofthe curve-fit panel to check that your initial conditions are close enough. Remember tofreeze all but the two amplitudes. Measure the background separately, using WaveStats ona portion of the data (last part) and just fit to the decaying part. VERY IMPORTANT:set the known decay rates to be fixed parameters in the fit. From the amplitudes A and B,work out the effective numbers of atoms present at the beginning of the experiment, NL(0)and NB(0). Do those numbers seem reasonable?

If you do everything correctly, you should find a fit that is equally good as the singleexponential fit. It thus might appear that we have two equally good fits and that, all thingsbeing equal, one might prefer the single exponential to the double because it is “simpler.”But all things are NOT equal: In the first case, we have to conclude that we have found anew material with radioactivity that is unconnected to the radon-decay cycle lurking in thebasement. In the second case, we used the known half lives from materials expected to bepresent in the decay of radon gas. Thus, the situation is NOT the same. Even though thetwo fits are equally good, we prefer the one that is consistent with a pre-existing scenariosupported by independent observations. This kind of “prior knowledge” turns out to beessential in making inferences about theories.

1998-1 - Created NA; 2003-3 - Revised BJF; 2005-3 - Revised JB

Page 50: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

50 CHAPTER 4. RADIOACTIVE DECAY AND INTERVAL DISTRIBUTIONS

Page 51: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

Chapter 5

AC Circuits I: RC low-pass filter

5.1 Goals

• Explore the properties of an RC low-pass filter

• Notion of Bode plot

• Notion of filtering (applications to noise removal)

• Programming: Write a program to measure input and output of the circuit using amanually specified input.

• Data Processing: Use and understand program to estimate the frequency of a capturedperiodic waveform. Algorithm is based on measurement of zero-crossing intervals.

References

• PHYS 231 Reference Manual - Electronic Notes

5.2 Prelab Questions

1. (a) Calculate log10(n) for n = 0,1,2,...,10 and plot by hand log10(n) vs. n.

(b) Compare the following quantities: log10(2 + 4), log10(2 · 4), log10(2), log10(1/2),1

log10(2), log10

(√2), log10

(1√2

).

2. For an RC low-pass filter such as the one depicted in Fig. 5.1, derive general expressions(in terms of an arbitrary resistance R and capacitance C) for

(a) The amplitude response of the circuit, |Vout||Vin| .

51

Page 52: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

52 CHAPTER 5. AC CIRCUITS I

(b) The phase shift between Vout and Vin. To be precise, we define this to be the phaseof Vout relative to that of Vin. Define a phase lead to be positive and a phase lagto be negative.

(c) The −3dB frequency.1 This is the frequency where |Vout||Vin| = 1√

2and, thus, where

the power of the signal is reduced by 12.

3. Show that the filter’s amplitude response∣∣∣Vout

Vin

∣∣∣ is 6 dB/octave at high frequencies.2

4. Make a Bode plot of the frequency response of the filter shown in Fig. 5.1. A Bodeplot is a convenient way of visualizing the frequency response of the filter. It consistsof two graphs:

(a) A log-log graph of the amplitude response. Plot log (to the base 10) of∣∣∣Vout

Vin

∣∣∣vs. the log10 of the frequency. To get a good feel for the behaviour of the filter,you should start your frequencies two decades below the −3dB frequency andfinish two decades above. Thus, you will need to span four decades in frequency.(We plot the log of the frequency in order to see the behaviour of the circuit oversuch a wide range of frequencies.)

(b) A linear-log graph of the phase response. Plot the phase of the response – it willbe less than zero – on a linear scale but use the same log10 frequency scale usedfor the amplitude plot.

In the experiment below, you will need to make plots such as this for the expectedfrequency response of your circuit. Then you can add data, as collected, to the samegraph.

5.3 Experiments

Record your experimental method, observations, and results in your lab note-book.

1. RC Low-pass Filter (by hand). Construct the circuit shown in Fig. 5.1. Drive itwith a sine wave and measure both the attenuation and the phase shift between theinput and output voltages as a function of the frequency. Do this by hand, recordingvalues off the oscilloscope. To speed up the measurement, first find the −3dB point,then choose a few frequencies above and below to give you a reasonable representation

1The decibel scale is defined in terms of power ratios: dB=10 log10(Pout/Pin). Since the electrical powerP is proportional to the square of the voltage V , this definition is equivalent to dB=20 log10(Vout/Vin).Furthermore, 10 log10(1/2) ≈ −3, hence the name “−3dB frequency” for the frequency at which the powerdrops by a factor of 2 (or amplitude by

√2). This is also called the “cutoff frequency,” or “bandwidth” of

the filter.2An octave is a factor of two in frequency.

Page 53: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

5.3. EXPERIMENTS 53

1.2 k!

0.82 !F

Vin

Vout

Figure 5.1: RC low-pass filter

of the response of the circuit. (If you choose the frequencies with care, five or sixmeasurements should suffice.)

Measure the resistor’s value and use the −3dB point to calculate capacitance. Comparethe measured value to its nominal value.

Don’t forget to plot the data as you take it (using Igor). First plot the data using linearaxes; then make a Bode plot (log-log for attenuation, lin-log graph for phase). Enter thevalues in a table in Igor and append the waves, at the same time, to the various plotsfrom the homework. Then, as you gather more data, the graphs will automatically beupdated, showing simultaneously the expected plot based on the theory for a low-passfilter and your actual measured values.

From your data, you should be able to:

(a) Compare the −3dB frequency determined from the attenuation data and fromthe phase data. Which is more accurate?

(b) Check whether the filter attenuates 6 dB/octave (20 dB/decade) for frequencieswell above the −3dB point.

2. Computer-assisted measurement. Even the few measurements you did above mayhave convinced you that measuring frequency responses can quickly become tedious.Here, we will begin a process of learning how to use our data acquisition device (DAQ)to help speed up the process. Before we begin, we repeat that doing a few measure-ments – and thinking about them – is an essential first step. Computerizing the dataacquisition can relieve tedium, but it cannot replace thought!3

In this first AC lab, we will content ourselves to using the computer to measure thesignal going in to the circuit and the signal coming out. We will then add a very simplecontrol to manually set the frequency of the input signal. Next week, we will completethe program by using the computer to “sweep through” a series of inputs, recordingthe output for each frequency onto disk for analysis afterwards.

3Remember the expression “Garbage in, garbage out”: if you do not know what you are doing when youset up your computer program, the results will be worthless.

Page 54: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

54 CHAPTER 5. AC CIRCUITS I

Here, the basic goal is to write a LabVIEW VI to alternately read in the voltage beingsent to the circuit’s input from the function generator Vin and the voltage comingfrom the output of the circuit (Vout). In your LabVIEW VI, put in controls to setthe sampling interval and number of points sampled. Send the data to a front-paneldisplay graph (both channels on one display). Put in an option to save the data todisk.

In collecting data, set the sampling interval to its minimum value. (See the DAQmanual for this – there’s a sublety for multiple channels.) Recall that the DAQ willcollect alternately one sample from the input and one from the output and that thiswill affect how fast it can read. What effect will this have on the apparent phase shiftbetween the two signals? (Hint: you can always measure this by sending the samesignal to each input.)

In this lab, the input and output signals are sine waves. Open up the data you savedin Igor and display the two waveforms on one graph. Use cursors to measure theamplitude of each waveform, the period (and hence frequency), and the relative phaseshift between the two sine waves.

As a last programming step (for this lab), add a knob control (have it show alsoa numerical indicator) to set one of the analog outputs. Wire up this output to thevoltage-controlled input of the function generator. Use the Flat Sequence structure

to force LabVIEW to set the analog out voltage before it reads in the two voltages. (Wewill discuss this in class.) This will give you a way of setting the function generator’sfrequency from the computer.

Now go and repeat your measurements of the frequency response of the low-pass circuit.You should be able to take examine more frequencies with your “computer assist.”Again, plot the relative amplitudes and phases for the different frequencies on topof your calculated Bode plot, which should also have the data from the oscilloscopemeasurements. Use different marker symbols for the two data sets.

3. Data Analysis We will do one programming exercise to assist your analysis. Thiswill also introduce the notion of an Igor function – essentially a program that returnsa numerical value as a result. Our goal is to use (and understand) a program that willestimate the frequency of a sine wave that has been sampled and stored on disk (andloaded into an Igor wave, call it w). For example, you can generate a wave with fakedata by executing

Make /n=1000 w

SetScale/I x 0,100,"", w

w = cos(2*pi*1.1*x)

(The first two commands may be generated using the pull-down menus for Data /

Make Waves and Data / Change Wave Scaling in Igor.) This creates a wave w offrequency 1.1 Hz, with 1000 points and sets its scale to go from 0 to 100. (If the units

Page 55: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

5.3. EXPERIMENTS 55

are seconds, this means that each point is 0.1 s after the previous one and that thesampling rate is then 10 Hz.)

To evaluate its frequency, we simply count how many times the function crosses zeroover the whole interval (0 to 100) and divide by twice the time between the first andlast crossings. (Why twice?) Fortunately, Igor has a built-in operation, FindLevels,that finds level crossings (here, zero is our level).

The function get freq0(w) implements the above algorithm (see website). As anexercise to make sure you understand how well it works and what is going on, try it forfrequencies ranging from 1 to 20 Hz, using the test wave above. Explain the output.

Now you can use this function to measure the frequency output by the function gen-erator for your data. One thing you need to do for get freq0() is make sure that thewave that you give it has its x-values scaled correctly. The default for Igor is for thex-values to be set equal to the point value of each element. You need to assign thex-value so that they correspond to the time each wave is sampled. Go to Change Wave

Scaling and, under Set Scale Mode use Start and Delta. Then select the startingtime (0) and the time increment per point. (For 20 kHz, this would be 50 µs, which iswritten 5e-5.)

You will still have to measure amplitudes and phases by hand (in Igor) from the graph.(In the next lab, we will introduce better ways to do these tasks, too.) For now, youcan use the cursors to measure amplitude. For phase differences, you can either usethe cursors or use the drag feature (click down on a graph for about a second and youcan drag it, with the offset in x and y shown as you drag). To measure the phase shift,you can also use the difference between crossings of the average values.

4. Optional. Set the signal generator to a single square wave frequency and measure(using the oscilloscope) the risetime response of the low pass filter from 10% to 90%of maximum.4 Compare with the theoretical relation

trise =0.35

f3dB

.

For your information: What’s a low-pass filter good for?

Low-pass filters like the RC-filter we have been looking at (and other, more complicatedcircuits) have many uses. Perhaps the most important is to separate a signal from noise thatcontaminates it. Loosely speaking, noise is mostly made up of high-frequency components(that make the sharp features characteristic of noise). The low-pass filter will attenuatethese, while letting the signal through. Of course, the frequency of your signal should be lessthan the −3dB frequency of the low-pass filter. The action of a low-pass filter is illustratedin Fig. 5.2.

4If you look closely, you will see markings on the scope scale labelled from 0% to 100%. In particular thelines for 10% and 90% are present expressly for measuring risetimes.

Page 56: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

56 CHAPTER 5. AC CIRCUITS I

One place where low-pass filtering is needed is to prevent the aliasing problem we dis-cussed in Ch. 1. If you try to read a signal into a computer, high-frequency noise can distortthe signal you measure. One prevents this by using a low-pass filter whose −3dB frequency is5-10 times less than the sampling frequency of the A/D converter. This is the “anti-aliasing”filter mentioned in Ch. 0 and is an essential part of a computerized data-acquisition setup.

+ =

! =

Signal Noise Noisy Signal

Noisy Signal Filtered SignalLow-pass filter

Figure 5.2: A low-pass filter may be used to remove noise. Top: sine-wave signal is contam-inated by noise. Bottom: Passing a noisy signal through a low-pass filter circuit reduces thenoise.

Page 57: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

Chapter 6

AC Circuits II: RC, RL, and LCRcircuits

6.1 Goals

• Explore the properties of different AC circuits, including RC high pass, LR high pass,and LRC serial circuits.

• More applications of filtering: (AC coupling, tuners).

• Data collection: Automate the data-collection process by adding an overall loop.

• Data analysis: Use (and understand) an Igor function to measure the relative phasebetween two sine waves. Use (and understand) an Igor function to load in the datasaved in LabVIEW. Write an Igor function to estimate the number of points per cyclein a digitized sine wave.

References

• PHYS 231 Reference Manual - Electronic Notes

• Any text with some theory about AC circuits will be useful.

6.2 Prelab Questions

1. Derive the analytic form of Bode plots for the RC, LR, and LRC circuits shown inFigs. 6.1, 6.2, and 6.3. Plot these for the values shown in those circuits. In the lab, beprepared to redo these plots based on your measurements of the actual R, and C forthe components you use. (We don’t have a direct way of measuring L, alas, but youcan adjust your value to fit your data...)

57

Page 58: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

58 CHAPTER 6. AC CIRCUITS II

2. In this lab, we will need to generate a list of frequencies that are evenly spaced on alog plot. Come up with a function that, when given a set of integers from 0 to Nmax,outputs equally spaced – in log – voltages for the DAQ that range from 0.01 to 5 Volts.We will later use this function in a LabVIEW program.

3. One task that we will have to do repeatedly in this lab is to measure the relative phaseof the two waves corresponding to the sinusoidal input to the circuit and the sinusoidaloutput. Explicitly, these waveforms are given by

Vin(t) = V0 cos(ωt− ϕ0) (6.1)

Vout(t) = V1 cos(ωt− ϕ1) , (6.2)

where ω = 2πf , f is the frequency, and ϕ0,1 is the phase of each wave. Last time, wedid this by hand, using cursor controls on graphs where the two functions were bothplotted. This is a bit slow....

During the lab, you will write a LabVIEW VI we write to do a frequency sweep, record-ing a pair of sine waves at each frequency. The result will be a single data file, withtwo columns (one recording the input to the circuit, the recording the output). Thecolumn will be Ndat ∗Nseg long, where Ndat is the number of frequencies measuredand Nseg is the number of data points/segment.

The first step will be to load the data into Igor. We have provided two Igor functionsthat will help you in your analysis. DisplayData(v1, v2, Ndat,Nseg, Sfreq), displaysa graph that shows one data set at a time, with a control to select which data setis viewed. The other Igor function, get freq amp phase(v1, v2, Ndat,Nseg, Sfreq),extracts the frequency, amplitude, and phase of the two sine waves in each data set.You call one of the functions by typing its name in the command line, with v1 and v2the names of the two waves containing the data, Ndat the number of frequencies youhave measured, Nseg the number of points measured per frequency, and Sfreq thesampling frequency. (Each of the waves you supply will have Ndat ∗Nseg points.)

The get freq amp phase() function goes through a loop where it extracts a data setand calls three sub-functions, get freq(), get amp(), and get phase(). We alreadywrote the first function last week. Now, we have to think about the latter two functions,which extract the amplitude of a sine wave and its phase (relative to the starting timeof the data set). Explicitly, let us say that the input and output to each circuit is givenby Eqs. 6.2. Your task, for each frequency f , is to write three Igor functions that findthe relative amplitude V1/V0 and phase shift ϕ = ϕ1 − ϕ0 as a function of frequency.

(a) get amp(w): Given a wave w containing a sine wave, return its amplitude. Thereare a number of possible approaches. One is to look for the maximum and mini-mum. In Igor, this is simple: just execute the operation WaveStats, which returnsthe variables V max and V min, the maximum and minimum of the waveform,respectively. This is simple, but if there is much noise on the curve, not very

Page 59: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

6.3. EXPERIMENTS 59

accurate. Why? Another approach is to use the RMS (root-mean-square) volt-age, also available through WaveStats. What is the relation between the RMSamplitude and the peak-to-peak amplitude for a sine wave? Why might the RMSbe better? (Compare the two, and also compare with a direct plot for at least atest case, in order to check which method is better.) Using these ideas, create afunction get amp(w) that, when given a wave w that is sinuosoidal, returns itsamplitude.

(b) get phase(w1,w2): Given two waves w1 and w2 each containing sine waves,compute the phase difference between them. This function is available from thewebsite. It finds the “best” sine wave that fits the wave form and then usesreturns its phase. The catch is that the function requires an estimate of thenumber of points per cycle of the sine wave in order for the fit to converge. Writean Igor function Cycles(w) that takes a wave w (holding a sampled sine wave)and returns an integer that is the approximate number of points of data per cycleof sine wave. This function will be quite similar to the get freq(w) function ofLab 5. (The supplied function get phase requires this utility function in orderto work. You can test the supplied get phase by “hard-wiring” an explicit guessfor the variable n per cycle.)

(c) get freq: We already have a function to do this, but it has a problem: if thereis noise on the signal, then what should be a single zero crossing can appearas multiple crossings (with very little time between each crossing). While onecan smooth the curve to help prevent such artifacts, a better approach is to use acurve fit, as in get phase. Using the latter function as a model, write an improvedget freq function.

Using these three functions and the functions DisplayData and get freq amp phase,process the analysis routines on the test data supplied on the course website. Thetwo waves in the file each have 3 data segments, with 2000 points each. The samplingfrequency is 20 kHz. If your analysis routines are working correctly, you should findthat the three waves have frequencies around 70 Hz. Their amplitude ratio is about 0.3and the phase difference is about 70 degrees. (You may find that the phase functionreturns numbers that differs from these by 360 degrees. You can either tweak thefunction to eliminate this problem by testing for numbers that are too large or smalland adjusting by multiples of 360. Or you can do this by hand on the phase wave.)

6.3 Experiments

We have set this lab up so that the finite input impedance of the DAQ is a small effect. Insome cases, the effects may not be completely negligible and may cause “non-ideal effects”....

1. Programming. We begin with some data acquisition programming tasks that willspeed up the rest of the lab (and several others, too) quite a bit. Last time, we

Page 60: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

60 CHAPTER 6. AC CIRCUITS II

wrote a program that could set an analog output voltage that was sent to the functiongenerator and determined the frequency of its output. We then input two waveformscorresponding to the input and the output of the circuit. Now we take things a fewsteps further.

First, add an outside loop to your program. The loop should do the following:

(a) Set the analog voltage out (i.e., set the function generator frequency). Use a func-tion node (see example VI) to output evenly spaced log frequencies, as discussedin the pre-lab exercise. This function (fed by the For loop you have added)replaces the knob control of the previous experiment.

(b) Acquire the two analog signals (20 kHz sampling rate).

(c) Save the data to disk (use append, as before). The Igor data loader program willexpect all of the data to be sequentially in ONE file. It will be convenient not tosave the time data – just the two voltages.

Note that the frequency set by the analog voltage of the DAQ will depend on howthe function generator is set up. (The function generator’s lowest frequency is set bythe dial. You should manually set this to the frequency you want to start at. Thefrequency then increases linearly with voltage, so that at 10V, it is at the maximumof the range it is set on. Remember, though, that our analog out is limited to +5V.)

2. Calibration One systematic error that you should deal with is that the two waves youacquire are not sampled at the same time. Measure the time delay between measure-ments by sending the same sine wave to both inputs on the DAQ and measuring thephase difference. Do for some different frequencies to see whether it is a phase delayor a time delay that occurs. Later on, correct your phase measurements according toyour findings here.

3. Measurements. Once you have finished your program and dealt with the issue of thedelay between channels, measure the frequency response of the three circuits shownbelow (RC high-pass, LR high-pass, LRC series). Make sure that, at each frequency,you have enough data points to see at least one complete cycle. You should use the Bodeplots you calculated in the prelab to guide your choice of frequencies to scan. As usual,it is a good idea to do a quick scan of the frequency using the oscilloscope to displaythe input and output voltages. Don’t forget to note these preliminary measurementsin your lab book! Later, you should check whether your computer-aided measurementsare consistent with your quick hand measurements.

4. Data Processing. Now you should have lots of data on your hard drive! Hopefully,you will have working programs for processing the data from the prelab. You maynotice that sometimes the input voltage is not exactly constant. Why is this? In yourdata analysis for the Bode magnitude plot, remember that the function you plot is theratio of output to input magnitude.

Page 61: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

6.3. EXPERIMENTS 61

1.2 k!

0.82 !F

Vin V

out

Figure 6.1: RC high-pass filter.

Vin

Vout

L = 7H

R = 600 !

R = 3.3 k!

Figure 6.2: LR high-pass filter. The resistance and inductance are shown in a shaded boxbecause the inductors we use, made of wire wrapped around an iron core, have considerableresistance. Make sure you check these values!

5. Analysis. At this point, you should have experimental Bode plots for the three circuitsyou have measured. (Of course, you will have plotted these on top of your Bode plotsthat you calculated using nominal R, L, and C values. For each one, see how wellthe experimental points match the calculated curves. Discuss the discrepancies. (Wehave already mentioned one – that our inductor has a considerable resistance that iseffectively in series with its inductance.) In some cases, you may be able to accountfor the discrepancy if the nominal values of R, L, and C that you used to calculatethe Bode plots are in error. You can measure R and C using the DMM and try tocorrect your Bode plots accordingly. (Unfortunately, the DMM we use has no ready-made measurement of L). You can also manually tweak the values of these constants(particularly L, since you did not measure it independently). You may also find otherdiscrepancies. Comment on these... (In particular, why might one of the two high-passresponses be less ideal than the other?)

Page 62: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

62 CHAPTER 6. AC CIRCUITS II

C = 0.1 !F

Vin

Vout

L = 7H

R = 600 !

Figure 6.3: LRC series circuit. Note that all the resistance is coming from the inductor.

For the LRC series circuit, compare your data to the expected curve on a Bode plotand comment on any differences. Try adjusting L if the expected curve does not passthrough the data points. We will study this kind of response in much more detail inthe following two labs on mechanical resonance.

For your information: What’s a high-pass filter good for?

In this lab, we considered a high-pass filter. As you will have seen, it attenuates low fre-quencies and lets high frequencies pass. One application of high-pass filters is to do “ACcoupling,” an option found on all oscilloscopes. Very often, you have a small signal of in-terest that is sitting on a large offset. This can make it hard to measure the signal you areinterested in. If you knew the value of the offset, you could subtract that voltage and thenamplify the difference. But you might not know the offset value to subtract. Worse, it mightslowly vary over time. In such circumstances, a high-pass filter is very useful, as it blocksthe constant (or slowly varying offset) while letting through the signal of interest. One canthen amplify the small signal. This is how the AC coupling of an oscilloscope works.

Page 63: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

Chapter 7

Mechanical Resonance (2 Weeks)

7.1 Goals

• Investigate motion of a hacksaw blade (damping, resonance)

• Introduce curve fits

Introduction:

In this experiment, you will investigate the mechanical resonance of a hacksaw blade.Using this setup, you will investigate damped harmonic motion and the amplitude and phaseresonance curves for forced harmonic motion. You may notice that the structure of this labis in many ways very similar to that of the AC circuits we investigated before. There, weconstructed electrical circuits where we give an input (a sine wave) and measure the output(another sine wave). Here, we have a mechanical system, where we give an input (either aconstant as an initial condition or a sine wave) and we measure a response (velocity of thehacksaw blade). Both experiments supply an input and measure an output. Indeed, theLabView programs we developed for the AC circuit will, with small modification, be usedhere, as well.

The similarities are even deeper when we notice that the equations of motion that describea damped, driven harmonic oscillator are the same as those used to describe an RLC circuit.Thus, everything we have learned about RLC circuits can be applied to the present case.All we have to do is make appropriate substitutions (mass for capacitance, etc.).

Before starting the lab please read:

1. C. C. Jones, Am. J. Phys. 63, 232 (1995). This is an American Journal of Physicsarticle about the hacksaw-blade experiment.

2. Sections on Damped Harmonic Motion and Driven Harmonic Motion in your first-yearor PHYS-211 textbook.

3. PHYS 231 Reference Manual – section on Electrical Resonance

63

Page 64: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

64 CHAPTER 7. MECHANICAL RESONANCE (2 WEEKS)

7.2 Prelab Questions:

1. Week 1: In general, you should review the equations and solution for a forced, dampedoscillator. Think about the implications of measuring the velocity of the motion ratherthan the amplitude. Make sure you understand the notion of resonance and the differ-ence between the natural and forcing frequencies. Then do the following:

(a) Consider a damped oscillator described by the equation of motion,

x + 2γx + ω20x = 0 , (7.1)

where x(t) is the time-dependent displacement, γ is the damping rate, and ω0 isthe angular frequency of oscillations in the absence of damping. Show that thevelocity v(t) takes the form

v(t) = Ae−γt cos(ωt + ϕ0) . (7.2)

Find A, ϕ0, and ω in terms γ, ω0, and the initial conditions.

(b) In the accompanying Am. J. Phys. article, Eq. 6 claims that when you measurethe velocity of a harmonic oscillator, the resonance peak is always at the naturalfrequency ω = ω0, independent of the damping γ.

i. Prove this.

ii. Show that when you measure position instead, the resonance peak is at ω =√ω2

0 − 2γ2.

(c) Often, resonance is characterized by a “quality factor” Q. There are several waysthat Q may be defined. We shall primarily use the definition Q = ω0/(2γ).Another popular definition is Q′ = (frequency where amplitude is maximum) /(full-width at half maximum). Here, “half-maximum” means half the maximumpower (1/

√2 in amplitude).

i. For small damping (γ ω0), show that Q′ = Q.

ii. Show – again, for small damping – that it does not matter whether youmeasure Q′ from a plot of position vs. frequency or velocity vs. frequency.

2. Week 2: One of the goals of this course is to teach curve fitting, as it is both a wayof testing whether your model of an experiment is reasonable and, if so, of extractingfrom data the “best” parameters for that model. In particular, it is a key step inhow we learn something from an experiment. In the first part of the course, we did anumber of experiments where we tried to estimate a best fit “by eye.” Now that weknow how to do proper curve fits, go back to Ch. 4 and work through the exercises inthe final section, which involves re-analysis of the radon-decay experiment.

Page 65: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

7.3. EXPERIMENTS 65

7.3 Experiments

There are two experiments to do here and two weeks to do them in. If you finish withexperiment 1 in the first week and have extra time, by all means make a start on the second.You will turn in your lab book when both experiments are done.

Experiment 1: Free Oscillations

1. Mount the hacksaw blade and pick-up coil so that the blade extends beyond the brick.Test the natural oscillation frequency of the blade/coil combination. Is there morethan one? Focus on oscillations perpendicular to the flat part of the blade.

2. Use a pick-up coil and a magnet to detect the vibration of the hacksaw blade. Observethe signal on an oscilloscope. Explain what is being detected. Check the oscillationfrequency and adjust the blade length extending beyond the brick until the oscillationfrequency is about 12 Hz.

3. Investigate the amplitude of the signal detected as a function of the distance the coilsits within the magnet. Explain why this changes. Which configuration is best? Whatis a typical voltage amplitude for the signal?

4. Investigate the damping of the oscillation with and without an aluminum plate mountedon the pick-up coil as a function of the position of the coil in the magnet. Adjust thedamping for a suitable decay of the oscillations.

5. Now hook up the pick-up coil to the DAQ. You can use the internal gain of the DAQanalog inputs to compensate. This is an amplifier that is internal to the DAQ. Seethe manual for more details. (This amplifier is another example of signal conditioning.See Ch. 0.)

6. Record the motion of the system, both with and without the plate.

7. Plot the data. Determine the natural oscillation frequency and the damping constantby fitting model functions to the data. To fit the data, use Igor to do a nonlinearcurve fit. You will need to define your own fit functions for this and then guess initialvalues of the parameters in order to minimize χ2. You will also need to estimate thestandard deviation of your voltage measurements. (Think of a good way of doing this.Remember that you need to separate real variations from statistical fluctuations.) Ifyou do not use the graphing function in Igor’s Curve-fit panel to find initial values thatare reasonably close to the best-fit values, your fit will probably fail.

8. Record the estimates of the parameters you have measured and their uncertainties. Isthere detectable damping without the Al plate? Is the oscillation frequency the samewith Al-plate damping? Is the difference explained solely by the additional damping?

Page 66: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

66 CHAPTER 7. MECHANICAL RESONANCE (2 WEEKS)

Make sure that you finish the analysis of this part of the experiment before you go on tothe second part.

Experiment 2: Forced Oscillations

1. Go back and quickly redo a measurement of the free oscillation, to make sure thatyour estimate of the free-oscillation frequency has not changed. (Why might it havechanged?) Use the aluminum plate for damping. If you start this section in Week 1and are returning to it in Week 2, make sure you retake a full set of data where youlook at both free and forced oscillations.

2. Drive the system with the Pasco driver poking the hacksaw blade. (This is our “actu-ator.”) Note the cautions in the AJP article regarding the position and amplitude ofthe driving force. Make sure that the response of the system exhibits clean, sinusoidalbehaviour.

3. Drive the blade-coil system at a series of frequencies around resonance.

4. Do a frequency sweep to record input and output data at frequencies centred on theresonance. Scan as wide a frequency range as possible. In addition, make sure you getenough data for interesting parts of the response curve. Use the program developed forgetting the frequency response of AC circuits. You will have to reset various parametervalues to be appropriate for the mechanical case. You may also want to think abouthow many frequencies to take, whether a log or linear frequency scan is better, etc.Also, think about transients and what to do about them.... Another issue: if youhave significant noise on the response measurement, you can use a capacitor to reduceit. Take the largest capacitor you have and connect it across the DAQ input for theresponse. Look on the oscilloscope to see whether this helps.

5. Analyze the data at different frequencies for relative amplitude and phase by fittingthe data using Igor.

6. Plot the amplitude and phase response of the system as a function of frequency. Fitthe resonance curve and the phase curve to determine the natural resonance frequencyand the damping constant. Estimate the uncertainties in the parameters you havemeasured. Compare the results from the experiments for free and driven oscillations.

7. Determine the quality factor Q from the resonance curve. Compare to Q calculatedfrom the decay constant and natural oscillation frequency. (You have two sets of param-eters you can use – one from the forced oscillations and one from the free oscillations.)

Finally, there are some overall issues you might want to think about in this experiment,which are relevant for last week’s as well. What happens as you increase the driving am-plitude at a fixed frequency? What amplitude should you use? Would it be better to try

Page 67: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

7.3. EXPERIMENTS 67

different amplitudes at different frequencies? Do you see any signs of another resonance(s)?If so, why might they occur? Can you get rid of them? Thinking about issues like these –and their implications for your analysis – are part of what makes up a good report.

BJF/2002-3 JB/2005-2, 2005-3

Page 68: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

68 CHAPTER 7. MECHANICAL RESONANCE (2 WEEKS)

Page 69: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

Chapter 8

The “Bug,” Part 1: Measurement andCalibration

8.1 Goals

• Overview of the Bug;

• Use of thermistor as temperature sensor;

• Notions of calibration, secondary and primary standards;

• Understand the analogy between thermal and electrical quantities

• Notions of averaging and filtering; noise vs. drift.

8.2 Prelab Questions

1. The resistance of the thermistors we use is related to temperature (in C), as follows:

T (R) =

(A1 + B1 ln

R

Rref

+ C1 ln2 R

Rref

+ D1 ln3 R

Rref

)−1

− 273.15 , (8.1)

where A1 = 3.354016 × 10−3, B1 = 2.569355 × 10−4 K−1, C1 = 2.626311 × 10−6 K−2,D1 = 0.675278 × 10−7 K−3, and Rref ≈ 10 KΩ is the resistance of the resistor at25 C. Plot this for temperatures ranging from 10 to 110 C (using Rref = 10 KΩ).Note that you are plotting temperature vs. resistance, so you will have to adjustyour minimum and maximum resistances so that the temperature spans the desiredvalues. Make a printout of your T (R) graph with gridlines. (See Ticks & Grids inthe Modify Axes dialogue of Igor.) What resistance corresponds to 100 C? To do thisproblem, it will be useful to define an Igor function in the Procedure Window. Define afunction r2t(R,Rref ) that takes a resistance R, a reference resistance Rref , and returns

69

Page 70: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

70 CHAPTER 8. BUG 1: SYSTEM CALIBRATION

a temperature. Then define a wave called Temperature. Go to Change Wave Scaling

and set its x values to range between the minimum and maximum resistance you expectto see. (You may have to play around to get the right values – they are chosen so thatyour range goes from 10 to 110 C, as described above.) Then simply evaluate in thecommand line, Temperature = r2t(x) and Igor will go through an implicit loop andassign to every x value of the wave Temperature the result of the function r2t.

2. We will measure the resistance using a voltage divider circuit such as Fig. 2.1, wherewe have a “normal” resistor R0 that is far from the heater (and not very temperaturesensitive) and the thermistor R(T ). Let the temperature range between T1 and T2. Fora given value of R0 (and fixed supply voltage), the voltage divider will give an outputthat ranges between two values, V (T1) and V (T2) . Show that the value of R0 that

maximizes this voltage range is given by R0 =√

R(T1)R(T2). If we want to measurebetween 10 and 110 C, what value of R0 is best?

3. Combine the voltage divider and resistance-temperature function into a single function.Make a table of 100 V -T pairs given nominal values of the thermistor’s referenceresistance and of the series resistor. Have the temperature values span 10 to 110 C(so that we cover slightly more than the range we care about, from room temperatureto 100 C). In class, you will evaluate this function using measured values of theresistances and save the resulting wave to disk. We will then import the data pairsinto LabVIEW as a lookup table, so that our input values are reported in C. Make asimilar function for the output power in terms of the voltage output on the DAQ forthe heater resistance of the Bug. We will also use this to have our output in Watts.(Again, just have the function ready – you will need the measured value of the resistoryou actually use.)

8.3 Experiments

Introduction

The last four labs in our course are a linked exercise. The nominal goal is to investigate thephysical properties of an unusual ceramic capacitor. The hidden goal is to get you to thelevel where you can conduct a computer-controlled experiment that has all the features ofthe diagram in Fig. 1 of Ch. 0. The processes we follow and the kinds of instrumentationand programs and data processing we use are standard for technical measurements, both inthe physics lab and in industry.

We begin by presenting the “Bug” (Fig. 8.2), named for its winsome resemblance to some-thing you’d probably prefer to step on.1 PLEASE DON’T STEP ON THE BUG! The ideais to glue together the capacitor we would like to study, a heater to change its temperature,

1The Bug in its original form was developed – and named – by Paul Dixon, at the California StateUniversity of San Bernadino, USA. We are grateful for his entomological contributions to Physics Education.

Page 71: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

8.3. EXPERIMENTS 71

and a temperature sensor, to be able to measure the temperature. Roughly speaking, theexperiment will consist in setting the temperature to some desired value, waiting for thingsto stabilize, recording data that will allow us to determine the capacitance, and then movingon to the next temperature. After analyzing the data from our “temperature sweep,” wewill have measurements of C(T ), the temperature dependence of the capacitance.

The plan, then, for the next four weeks is as follows:

1. (This week.) Thermal measurements. We measure the temperature of the Bug usingthe thermistor and apply power through the heater. We measure some of the propertiesof the thermal system (thermal resistance, relaxation time, heat capacity).

2. Temperature control. We build on the first week by learning how to regulate andcontrol temperature precisely.

3. Capacitance measurement. We measure capacitance by measuring the time constantin an RC-decay circuit (at fixed temperature).

4. We put everything together to sweep the temperature in a controlled fashion, measuringthe capacitance along the way.

Caring for the Bug: The Bug is a fragile fellow. It doesn’t need much in the way of food,but it does need some care to survive. As the glue is brittle and can fracture when stressed,we’ve soldered the leads for you into a socket. You can place the socket (gently!) on thebreadboard. Also, please do not clamp any connectors directly onto the leads that go intothe socket. Use wires on the breadboard to bring the connections somewhere else. If youever need to remove the Bug, you can slide a small screwdriver underneath the socket to pryit up.

thermistor

resistor / heater

capacitor

glue

(a) (b) (c)

Figure 8.1: Meet the Bug: (a) primitive ancestor; (b) anatomy: from left to right arethermistor, power resistor, and capacitor; (c) highly evolved descendent. (Was the designerintelligent?)

Page 72: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

72 CHAPTER 8. BUG 1: SYSTEM CALIBRATION

1. Preliminary hand measurements. Before we embark on our four-week odyssey tomeasure C(T ) by an elaborate, computer-controlled experiment, we will do a quick,crude “hand measurement” to motivate why a more elaborate set-up is needed. Con-nect up the capacitor on the Bug to your DMM and try to get a reading. Blow onit, and see what happens. Notice how the capacitance value drifts. Now touch thecapacitor with your hand while measuring with the DMM. Record your qualitativeobservations.

Clearly, this is a very temperature-sensitive capacitor! In order to measure its proper-ties, we need to take some care.

2. Calibrating the thermistor temperature. We begin by focusing on the small resis-tor in the Bug known as a “thermistor.” The thermistor is made from a semiconductormaterial that has a very strong decrease of resistance with temperature. This makesit well-suited to be a temperature sensor. Other resistors, such as the middle one weuse as a heater, have R’s that vary much less with temperature.

Using a resistor whose value is close to the R1 that you decided on in the PrelabQuestions, construct a voltage-divider circuit. For power, you can use the 5 Volt outon your DAQ (see its pinout). Check its actual voltage with the DMM, and also seewhether your circuit loads the power supply appreciably (by checking voltage of thesupply with and without your circuit). For this part, measure the output of the voltagedivider with the DMM. Use the relations in Ch. 2 to convert the output of the voltagedivider to a resistance for the thermistor.

An important step in the use of any sensor is calibration. We measure a resistance butwant to know the temperature. Thus, we need to calibrate the sensor by setting it toa known temperature and measuring its resistance. In principle, we should do this atenough temperatures that we can fit a calibration curve through the R(T ) data pointsand then use that function to convert R(T ). That would take a long time...

Fortunately, there is a shortcut. Thermistors are very common, and many people havestudied their properties. They find that they can be reasonably accurately modeled(near room temperature) by an equation of the form of Eq. 8.1. The coefficients A1,B1, C1, and D1 depend only on the material used for the semiconductor and thus canbe measured once and for all (by someone else!). All that is left to do is a “one-point”calibration. This is just a fancy term for saying that we have to fix one term, Rref forthe particular thermistor we choose. Because of manufacturing variations, the actualresistance of the nominal 10 KΩ (at T = 25 C) thermistor we use will vary slightlyfrom thermistor to thermistor. Thus, we can improve the accuracy of our temperaturereading by measuring this resistance at T = 25 C. One catch is that we don’t reallyhave a simple way of fixing the temperature to be 25 C. After all, our goal is to beable (next week) to set the temperature to some desired value! Here is a simple wayof doing our calibration:

We take as our calibration standard a mercury thermometer. At the appropriate point

Page 73: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

8.3. EXPERIMENTS 73

in the class, when everyone has set up their voltage divider and can measure resistance,your instructor will shout out the temperature of this thermometer. At that time, youwill record the output of your voltage divider (and hence its resistance). Then youwill know the resistance of your thermistor at whatever the temperature of the roomwas at the moment the instructor shouted out the reference value. Then you adjustyour value of Rref so that the temperature given by Eq. 8.1 matches the thermometer’stemperature.2

After you have found the value of Rref , you can use that value and the measured valueof your voltage-divider R to generate the final version of the look-up table. It shouldhave 100 points and span the range from 10 to 110 C. (This should be basically thesame as what you generated for the pre-lab.) Save the data in tab-delimited form to atext file. Then, in LabVIEW, make a new VI and use the DAQ assistant to create ananalog input for voltage. In the configuration dialog, you will see a “Custom scaling”pull-down tab. Create a new scale, using a table, and import the table you just created.Be sure to label the “pre-scaled” units as volts and the scaled units as degC. Note thatyou should then set the input range to be between 10 and 110. (There will be an errorif you allow values outside the range of the look-up table.)

3. Calibrating the heater power. In the above section, we calibrated the sensor input.In other words, we converted the voltage signal from the thermistor into a temperaturereading. In this section, we do the analagous to the actuator output: we convert thevoltage sent to the resistor heater into the equivalent power. Recall that the powerdissipated through a resistor R is P = V 2/R. For the small power amplifier that wesupply, there is a gain of about two. (Check it!) Take this gain into account in yourcalibration. Measure the nominal resistance of the resistor with a DMM, and use itsvalue to generate a look-up table for the analog out of the DAQ. Use another DAQassistant node to create an analog-out task and repeat the procedure used above. Youshould find that the maximum power is around 4 W.

Now that you have calibrated both the thermistor input and the heater output, youwill have schematically the setup illustrated below.

2You may wonder, “Who calibrated the mercury thermometer?” And how did they do that? Well, clearlyit was the manufacturer who printed a scale on the glass thermometer that converted a length of a columnof mercury to a temperature. Presumably that was done by using some other temperature standard. Buthow was that calibrated? You may worry that there is an infinite regression, but the answer is that thethermistor, the thermometer, etc. are all secondary temperature standards that we define with referenceto some ultimate primary temperature standard that is calibrated against the physical systems that definethe Celsius temperature scale. Making primary standards is the job of national laboratories, such as theInstitute for National Measurement Standards (INMS) in Canada and the National Institute for Science andTechnology (NIST) in the US. They use internationally adopted temperature definitions related to physicalproperties of materials, such as the triple point (where solid, liquid, and vapour all coexist). For example,the triple point of water defines the temperature 0.01 C. The convention that defines this is known asthe International Temperature Scale of 1990, or “ITS-90” to its friends. You can read more about it athttp://inms-ienm.nrc-cnrc.gc.ca/en/research/international temperature scale e.php.

Page 74: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

74 CHAPTER 8. BUG 1: SYSTEM CALIBRATION

Controller

T(R(V))

V(P) D/A

A/D

Computer DAQ System

heater

thermistor

P out

TinT in

Pout

Voltage

Divider

Power

Amp.

Vin

Vout

Figure 8.2: Schematic of the “Bug” with calibration of thermistor and power output. The“controller” will be implemented in the next lab.

4. LabVIEW Programming. Write a VI that can set the heater output and plot on achart the thermistor temperature, as follows:

(a) Configure the analog input (1 sample, on demand). Make sure you use the customscaling to convert to temperature.

(b) Output to a Waveform Chart.

(c) Add an analog output, configured in W. Recall that you need to use a separateDAQ assistant node. Make sure to configure the upper limit (around 4 W)to correspond to a voltage at or just below about 10 V (what you need to getcomfortably to 100 C). Put in a knob control for the analog out. To be extrasafe, in the knob control properties, configure the data range to be between 0and your upper limit. You can then set the scale to go between those limits, too.Also, use a DMM to monitor the voltage at the output of the power amplifier. Becareful that a program error does not leave it stuck on maximum output (10 V).That will quickly fry your bug!

(d) Put the Analog Out and then Analog In code in a Sequence structure. Put thesequence structure in a While loop.

(e) You should now have a program that will let you set the power using the knobcontrol and will measure the temperature and display it in a chart. Test this byDISCONNECTING THE OUTPUT of the heater’s power supply and runningthe VI. You should see the temperature around room temperature. Run the knobfrom zero through its maximum value. You should see the power supply’s voltagego from 0 to about 10 V. If not, consult with an instructor or TA before proceedingfurther – we don’t want to have a meltdown!

(f) Once you are satisfied that your VI is working, reconnect the power supply tothe heater and run the VI, initially setting the heater at 0W. Again, you shouldsee a temperature around room temperature. When you increase the heater, the

Page 75: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

8.3. EXPERIMENTS 75

temperature should rise rapidly. When you cut the heater power, it should alsodrop rapidly. If everything works correctly, at maximum power, it should makeit to 100 C using about 1.7 W of power.

Note that the supplied power amplifer has a polarity. If you reverse the connections,so that ground goes to high and vice versa, the supply is protected, but you will notget the output you expect.

5. Characterizing the heater-thermistor system Now that we have our sensor signalin degrees C and our heater signal in Watts, we can investigate the thermal charac-teristics of our combined thermistor-heater system. Please refer to the discussion inCh. 4 of the reference manual for a description of a simple thermal system. The mainresult is Eq. (4.4), which states

T (t) = −λ[T (t)− T0] +1

CP (t) , (8.2)

where T (t) is the time-dependent temperature of the system, C is its total heat capacity(in J/C), P is the external power input to the system by its heater (in W = J/s), λis the relaxation rate (in s−1), which is proportional to the thermal conductivity of thelink between the system and its external environment (i.e., the insulation). We havealso explicitly put back in the reference temperature (the ambient temperature of theroom), T0.

We can understand Eq. 8.2 better by noting that there is an analogy one can makebetween thermal and electrical quantities, as shown in the Table, below.

Thermal Electricaltemperature T ⇔ V voltage

ambient T0 ⇔ V0 groundpower P ⇔ I current

heat capacity C ⇔ C capacitance

Let us now imagine applying a constant power to our heater. According to Eq. 8.2,the temperature should eventually come to a steady-state value,

∆T = P(

1

λC

), (8.3)

where ∆T ≡ T−T0 is the temperature increase above ambient. Equation 8.3 is nothingmore than the thermal analogy to Ohm’s Law, V = IR. We can thus define a thermalresistance RT = 1/(λC) in analogy to the electrical resistance R. The units of RT are

Page 76: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

76 CHAPTER 8. BUG 1: SYSTEM CALIBRATION

in C/W.3 4

• Now measure RT for your Bug by applying a constant power to the heater andmeasuring the temperature at which the system settles. Plot T (P ), and determine RT

by curve-fitting to find the slope.

All the above analysis has been at DC – we set a constant heater power and read the(approximately) constant temperature that results. A fuller characterization wouldinvolve looking at the frequency response just as we did for the AC circuits of theprevious labs. You would simply apply a sinusoidal heater signal (offset from zerobecause you can’t apply negative power with a heater!) and then measure the sinusoidaltemperature signal – all as a function of frequency. Using the resulting frequencycurve, you could figure out an equivalent “thermal circuit” – an electrical circuit whosefrequency response would mimic what you measure in the thermal system. We won’tdo this here.

You may also be wondering why it matters to have the input and outputs in real units.Why not just stick with volts in both cases? For the thermistor, it’s clear that wewant to know the signal in C, as we want to measure capacitance as a function oftemperature. But why is it important to know the heater output in Watts? Well, asyou saw above (we hope), the measured steady-state temperature varies linearly withheater-power output. In other words, the relationship between the steady-state input(heater power) and steady-state output (temperature) is linear. It turns out that sys-tems whose output varies linearly with their input are easier to control than nonlinearones. Next week, we will add an automatic control loop to control temperature. SinceT (P ) is roughly linear, our task will be that much easier than it would be otherwise.

6. Minimizing the error in your temperature measurement. Now that we have away of reading in the temperature, it is time to think about ways we can improve theaccuracy of our measurement. As we have learned, averaging repeated measurementscan reduce errors. Recall that the standard deviation of N repeated measurements isσ0/√

N , where σ0 is the standard deviation of a single measurement. Thus, it wouldseem that we can reduce the error in our measurements by averaging N separate

3Thermal resistance is a common and useful way to specify insulation and heat transfer. As one example,integrated-circuit manufacturers will speak of the thermal resistance that a heat sink provides – they tryto make it as low as possible to minimize heat build up on components such as microprocessors and powertransistors. As another example, the insulation properties of different types of windows are specified by theirthermal resistance, or R-value, which is essentially the thermal resistance per area of material (C/W/m2.)Obviously, one wants a high R-value. In Canada, R-values are measured in units of degrees Fahrenheit per(British thermal units / hour) per square foot. God save the Queen!

4The existence of a relation such as Eq. 8.3 is no accident. In general, any kind of potential differencewill lead to the flow of a current. For electrical quantities, a voltage difference leads to the flow of charge –an electrical current. For thermal quantities, a temperature difference leads to the flow of energy – a heatcurrent. For liquids, a pressure difference leads to the flow of fluid – a mass current. For small enough flowsof essentially any quantity, there is typically a linear (Ohm’s-Law-type) relation between potential differenceand flow. Collectively, these are known as linear-response relations.

Page 77: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

8.3. EXPERIMENTS 77

measurements. But what value should we choose for N? At first glance, you mightsay, the more the merrier, but if you think about it some more, that cannot be right.If we average over too long a time – if N is too big – the temperature in the room willdrift and change the average that we are trying to compute. If we were to average, say,over a few hours, the room temperature would be changing and the standard deviationwould be set by how much the room temperature was changing and not by the noise inmeasurement. So, clearly, while some averaging is good, too much averaging is bad.5

In this section, we will explore the effects of averaging our signal N times each measure-ment. Our goal will, first, be to modify our VI to report the average of N measurements(taken at the maximum rate of 48 kHz) rather than a single reading. Our ultimategoal will be to choose an appropriate value of N .

(a) LabVIEW programming. Modify the VI you wrote above to average N mea-surements (but keep the original VI!). We could do this in Igor, but it will beconvenient to use LabVIEW’s analysis tools in this case. In detail,

i. Set the Analog In DAQ assistant to read N = 10 samples at 48 kHz.

ii. Output those values to a Statistics Express VI (in the Analysis functions).Configure the Express VI to report the arithmetic mean. This mean valuewill be the temperature measurement we record.

iii. Display the mean in a waveform chart. Send the data also to a Write LabVIEW

Measurement File Express VI, where you append to a file. (Store the timevalues, too.)

(b) Run the above VI, recording about 30 s of data to disk. Make sure the heater isoff (and the Bug at room temperature) before recording your data.

(c) Make a histogram of the temperature measurements (over a sub-range smallenough that you don’t see any obvious variation of the temperature beyond thepoint-to-point variation produced by your measurement noise). How consistent isyour histogram with a Gaussian distribution? (Try different bin sizes to get onethat best shows the form of the distribution. If bins are too small, the fluctuationswill be too big. If too large, you lose too many details about the shape.)

(d) Repeat the run, with N set to 100, 1000, 10000, and 100000. In Igor, plot thedata sets for different N on a single graph. (No need to do histograms for these.Also, you may want to offset the plots so that they don’t overlap each other.)You should see in the time series that the greater the amount of averaging, thesmaller the statistical variations from measurement to measurement.

5There are other, more fundamental reasons for drifts. It turns out that even if the temperature wereperfectly constant, your measurement would show similar kinds of drifts. This phenomenon, called “1/f”noise, occurs in an amazing number of places in Nature, from resistors to traffic flow to music to the floodlevels of the Nile river! See http://www.nslij-genetics.org/wli/1fnoise/ to learn more. Thus, even ifthe temperature were perfectly constant, 1/f noise in the thermistor would limit the amount of averagingthat one should do.

Page 78: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

78 CHAPTER 8. BUG 1: SYSTEM CALIBRATION

(e) For each time series, use cursors to choose a small portion that shows only statis-tical variations and use WaveStats to compute the standard deviation. Plot, inIgor, the measured standard deviation vs. N . Does it have the expected form?You may find for large N that it’s tough to avoid non-statistical variations. Why?Do the best you can to compensate.

(f) Choosing N . You might think that you should choose N so that the averagingtime is comparable to the time scale for the temperature variations you haveobserved. However, there is another kind of temperature variation that we haveto worry about measuring – that due to the heater. If you think about it, thisvariation should be faster than the natural variations. (If not, your heater wouldnot be much good at changing the temperature.) With this in mind,

i. Reset N to an intermediate value (e.g., 1000).

ii. Record a time series. This time, start with the heater off. Then briefly turnit on full for a couple of seconds; then turn it off. Keep recording until thebug cools back to around room temperature.

(g) Data processing.

i. In Igor, examine your time series and estimate the largest slope (C/s). Thisis the fastest temperature variation you can possibly measure.

ii. Plot the standard deviations you measured above vs. the total averaging time(N∆t). On the same graph, plot temperature vs. time for a line with slopeequal to the maximum slope you measured above.

iii. One can argue that the intersection of these two curves gives a lower boundto the N you should choose for measuring the temperature. Why? Whattime does this give? How many samples N does that correspond to?

iv. From your time series averaging over different N ’s, what would be the largestpossible N you should choose? Why? We thus have a range of reasonableN ’s. For next week’s lab, we’ll pick a convenient intermediate value.

(h) Finally, try fitting an exponential to the portion of the time series showing thedecay back to room temperature. What time constant do you get? (Think aboutthe details of the fit: what should you use for the standard deviation that goesinto the calculation of the χ2 statistic? Is your fit good in the statistical sensewe defined in previous labs? If not, is it “good enough”? If so, what does thatmean?) From the value of your time constant, deduce the rate λ and, hence, theeffective heat capacity, C.

Page 79: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

Chapter 9

The “Bug,” Part 2: Introduction toTemperature Control

9.1 Goals

• Notions of control theory (PID regulation)

• Play the control “game” (manual control and P, PI, PID versions)

• Programming: Add LabVIEW knob to control temperature. Add PID module forautomatic control.

References

• Control Theory chapter in Reference Manual.

• “LabVIEW in 6 hours” tutorial (on course website)

9.2 Prelab Questions

None. For programming, you should take a look at the “LabVIEW in 6 hours” tutorialavailable from the course website. It gives a more in-depth introduction to LabVIEW. Wewill be building up to using some more advanced concepts of LabVIEW programming inLabs 10 and 11, and it will be good to get a start on reading things. One thing relevant thisweek is the notion of a shift register. We use it in the (supplied) sub-VI that implements thePID algorithm. (You can download it from the course website.) Another concept to checkout, for later on, is the case structure (LabVIEW’s analog of the If-Then-Else constructionof normal programming languages). Look in particular at the Powerpoint presentation, slide72.

79

Page 80: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

80 CHAPTER 9. BUG 2: TEMPERATURE CONTROL

9.3 Experiments

1. Introducing the Control Game. We begin by explaining how to play the “controlgame.” The object of the game is to regulate the temperature about some desired “setpoint.” We’ll arbitrarily fix our set point at 60 C. Now go back to the circuit youmade last week for measuring the temperature of the Bug.

2. LabVIEW programming: Use an overall While loop with a 200 ms execution time.(Use a Wait until next ms multiple node.) This time will be needed for the mea-surement of the temperature, for the computations in the control loop, and, in the finallab, for the RC-decay measurement. By using the Wait until next ms multiple

node, we will make the program wait for a full 200 ms, regardless of how long the op-erations inside the loop actually take. This will ensure that the loop interval stays thesame, despite any changes in the computer load, etc. Now, inside the While loop, placea Sequence structure with four separate frames. (Right-click the Sequence structurebox to add another frame.) These frames ensure proper sequential execution of theprogram.

(a) In Frame 1, read temperature for 20 ms, acquiring at 48 kHz, and compute theaverage using a Statistics node. Empirically, this amount of averaging N gavegood results on our test Bug. It’s possible yours will be better off with a differentvalue. But start with this one. This will be our raw signal. From last time, whatdo you expect the standard deviation about this average value to be (in C)?What is it for a single measurement? This average value will be the temperaturereading we use for our control loop. As before, output your temperature signalinto a chart. Have the chart record the last 30s of data. (On the front panel,right-click the chart and see Chart History Length.) One other subtlety is thatit will be better to convert the data structure coming out of the DAQ assistantVI (which has the temperature data, the time stamp, etc.) to a simple double-precision real number (without time data). Use a conversion node (DBL) to dothis. (See All functions – Numeric, etc.) There is no need for a WriteLVM node;we won’t be saving the time series to disk for this lab.

(b) In Frame 2, place the supplied PID sub-VI and wire up the needed controls (Kp,Ki, Kd, set point). You can get the time interval (100 ms) from the control forthe loop time. You also need to let the sub-VI know the lower and upper limitsof the output (0 and 4 W). Since these won’t be changing, you just use constantsto set them in the block diagram.

(c) In Frame 3, put in a select node, controlled by a flip switch. Use this switchto select the output. Wire the output of the PID sub-VI to the “true” branch.Wire a knob control to the false branch. Take the output of the select node tothe input of the DAQ assistant controlling the analog out to the heater. This willallow for switching between manual and automatic control.

Page 81: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

9.3. EXPERIMENTS 81

(d) In the last frame (number 4), compute statistics relating to the quality of thetemperature control. Make a property node of the chart that contains its accu-mulated data (up to 30s worth) and use another Statistics node to computethe range (maximum − minimum), as computed over the last 30s. This will beour measure of how much the temperature is fluctuating.1

3. No control. Having created a program to control the temperature, we will start byfirst establishing a benchmark for control. First, record a typical range of fluctuationsaround 60 C by setting the power to a constant value, leaving the Bug exposed. (Inother words, you don’t put on any control at all. Call the range over 30 s. Jno control.Hopefully, temperature control will lead to a smaller J !

4. Passive control. Place the small, covered Tygon tube over the Bug, to shield it fromair current. Measure Jpassive. We can think of the shield as making a kind of thermallow-pass filter that attenuates high-frequency disturbances. Since this is a simple thingto do, it is a typical part of any control system. (For temperature control in a house,this is the walls, double-glazed windows, etc.) Keep the insulation tube on for theremainder of the labs.

5. Manual control. Switch the toggle in your LabVIEW VI to have the knob controlthe power amplifier. Control the temperature by manually controlling the knob iconon your screen. Call your best score Jc knob. Is it higher (worse) than Jknob? If so, whydo you think that is?

6. Proportional Control (P). Next, flip the toggle switch to engage the feedback loop.Make sure the set point is 60 C. We begin with proportional control. Because we wantto be able to turn off the integral and derivative terms, we use the parametrization Kp,Ki, and Kd. While still stabilizing about a set point of 60 C, choose a small initialvalue of Kp (try 0.1), while keeping Ki = Kd = 0. See what J is. Put a small tubeover the bug to shield it from direct air currents. Now what is the J? Investigate theeffects of different choices for Kp. For each Kp, record the J statistic. Also, record itsTavg. Plot Tavg vs. Kp. Does it have the form predicted by Eq. 4.8 of the referencemanual? (Try a curve fit with the proper form. Hint: your Kp is not quite the sameas the Kp used here. The one used here is dimensionless, while the one you use has aconversion factor, from temperature to power.) Plot Jp vs. Kp. Is there an optimumvalue of Kp? You should find that there is an instability of the temperature for someK∗

p . Don’t let the temperature “run away” too much! Estimate the period τ of thetemperature oscillations for Kp ≈ K∗

p .

1This is a conservative measure. People sometimes use the standard deviation of the points about theiraverage. Obviously this gives a smaller number. If all you care about is the typical distance from the stablevalue, this is reasonable. Our criterion keeps track of the worst case over 30s. The choice of a time period of30s is also somewhat arbitrary. We will need stability over roughly this time period for our measurements.Also, if we choose something longer than 30 s, then the lab will be slow!

Page 82: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

82 CHAPTER 9. BUG 2: TEMPERATURE CONTROL

7. Proportional-Integral Control (PI). Now we consider the effects of an integralterm. Reduce Kp to about 0.5K∗

p . Add in a small value of Ki. What is the asymptoticerror (setpoint minus the actual temperature) now? With PI control (no derivativeterm), you will find that you cannot have a very high Kp, as the integral terms tendsto make the system more unstable.

8. Proportional-Integral-Derivative Control (PID). The derivative term can dra-matically increase the performance of a control loop. Start to increase the Kd termfrom zero. As you do so, you should find that eventually you can increase Kp wellbeyond the K∗

p value. Once you get a good balance between Kp and Kd, try nudg-ing both up together and see how big you can go. What happens as Kd become toobig? (Hint: look at the power-out chart.) Use Jpid as your figure of merit for quality.(Strictly speaking, the amount of averaging N is also a parameter and one could alsoimagine varying that, as well. That gives a four-parameter space to explore!) Also,try to increase Ki. See how the time to relax to the asymptotic value (60 C) becomesshorter as Ki increases. Stop when the response is near critical damping.

9. Playing around. Now that things are working pretty well, play around some. Trychanging the set point up and down. What is the response look like? Can you explainwhy there is a tendency to overshoot the set point just after it is changed? Later on,we will be ramping the temperature in steps of ∼ 1C. Make sure that you can stabilizeto the new temperature in a reasonable time – e.g., a range J under 30 mK in lessthan a minute. What happens when the set point is either near room temperature ornear the maximum temperature you can achieve?

10. OPTIONAL (Step response of a P-controller): Another way of characterizing adynamical system (fancy words for the system you are controlling) is to look at its stepresponse. Make a small increase to the heater output in the open-loop system (i.e.,without the controller), and record how the temperature rises to its new steady-statevalue. This is the open-loop response of the system. Now make a slight decrease. Doyou get the same result? The closed-loop response is obtained in a similar way, exceptthat now you make the change in the setpoint and your response is measured with thefeedback loop on. Look at the closed-loop step response for a proportional controller,for various values of Kp. Describe what is happening as you increase Kp. (Hint: you’veseen a similar dynamical response in a previous lab....)

11. When you are finished, do NOT take apart your circuit. We will be using it in laterlabs.

And the winner is...

At this point, you will have played the control game six ways and come up with a score foreach: Jno control, Jpassive, Jm knob, Jc knob, Jp, Jpi, and Jpid. Comment on their rank (which isbest, next best, etc.) and try to explain the differences.

Page 83: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

9.3. EXPERIMENTS 83

Everything we have done so far has been at T = 60 C, but we will be interested intemperatures from room temperature to 100 C. With your best choice for Kp, Ki, and Kd,measure J for set points of 40 and 100 C. Now try to get the system to regulate at 1 Cabove room temperature. Why does this not work so well?

Epilog

The “control game” that we have been playing in this chapter has a more formal name:“optimal control.” The idea is that if you can formulate a function that assigns a numberto the control loop – in our case, the function was the RMS deviations averaged over atime interval of one minute – then you can look for the “best,” or “optimal” values ofthe parameters in your control loop. These are just the ones that minimize your “penaltyfunction.” Optimal control is a field unto itself. The rough idea is that if you can characterizeyour system and the effects of any feedback loops mathematically and evaluate the penaltyfunction J(Kp, Ki, Kd), then you can find the optimal values of any parameters (such asKp, Ki, and Kd) by taking derivatives: ∂J/∂Kp = ∂J/∂Ki = ∂J/∂Kd = 0. Of course, youhave to make sure you have indeed found a minimum. Here, we let you manually search thePID parameter space (Kp, Ki, Kd), with some guidelines given. But you can imagine thata recipe to give the best values would be helpful. This is where measuring the frequencyresponse of the physical system (i.e., its transfer function) is helpful. This allows one tocreate a model of the system and then to analyze – on a computer – the effects of differentparameters and to search for the best combination.

The PID control law turns out to be the right form of control law to choose if thedynamical system that is being controlled has an open-loop response that looks first-order(“RC-like”) or second-order (“LCR-like). Real systems – including the Bug – have morecomplicated dynamics. (They are like a big network of resistors and capacitors wired togetherin a complex way.) As a result, one can do better if one allows the control algorithm to bemore complicated than the PID form we use here. But, as you will have seen, even on acomplex system, the PID algorithm can do pretty well, and for this reason, it is universallyfound in general-purpose controllers, both in the lab and in industry.

Page 84: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

84 CHAPTER 9. BUG 2: TEMPERATURE CONTROL

Page 85: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

Chapter 10

The “Bug,” Part 3: Measuring C byRC Decay

10.1 Goals

• Measure capacitance by RC time dependence.

• Data acquisition: Notions of triggering, averaging.

References

10.2 Prelab Questions

1. Show that the time dependence of the voltage across a capacitor is given by

(a) V (t) = Vo exp (−t/τ) (discharging)

(b) V (t) = Vo [1− exp (−t/τ)] (charging)

where the time constant is given by τ = R C.

2. When we measure the voltage across the capacitor, there will be an input impedanceRin from the DAQ that acts in parallel, as depicted in Fig. 10.1. In this case what isV (t) = V +

out − V −out? Is there just one time constant? If so, what is it? Note that while

the actual DAQ circuitry is a bit more complicated than that shown, the conclusionsabout having an effective time constant, however, will still hold.

10.3 Experiments: C by RC

1. Hand measurements. This week, we will focus on measuring the capacitance C ofthe Bug. Our strategy will be to look at the time-dependent charging and discharging

85

Page 86: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

86 CHAPTER 10. BUG 3: RC DECAY

Vin

Vout+

Vout-

R

C Rin

( )

Figure 10.1: Equivalent circuit for measuring capacitance via time decay of the voltage acrossthe capacitor, showing effects due to the finite input impedance of the DAQ. Note that theactual input circuitry of the USB-6009 is a bit more complex. (See manual.)

of the capacitor in an RC circuit. As always, however, we start by doing this roughly“by hand.” At this point, do not connect the Bug’s heater (i.e., your measurementof C will be at room temperature, whatever that is. But do not disassemble yourtemperature-control circuit from last week – we’ll need it again later.) Wire up a seriesRC circuit, using the Bug and an external resistor. Choose R ≈ 100 kΩ. From thenominal value of C that you can measure with your DMM, what time constant do youexpect? Connect the input to the circuit to the function generator, and output a 0 to5 V square wave. Choose a frequency f ≈ 100 Hz. (This will be important for nextweek.) From the oscilloscope, estimate the decay constant. (Use a high-impedanceprobe!) Does it match what you expect given the values of R and C measured usingthe DMM?

2. Single-pass experiment. Now, we want to automate this. Our goal will be to getan accurate record of the discharge curve onto disk. We will proceed in two stages:

(a) Data acquisition. In previous labs, we focused on measuring frequency-responsecurves for different systems. In that work, we measured simultaneously the inputand the output and made relative phase measurements. We could do the sametype of measurement here, recording the square wave as input and the voltageacross the capacitor as output, but we’ll use a different approach. We aren’treally interested in the square wave waveform in itself. We really just want toknow when the capacitor starts to charge or discharge, as a way to know when tobegin our data acquisition. This leads to the notion of triggered data acquisition,where the DAQ starts the data acquisition on receipt of a trigger signal, which issupposed to be the rising or falling edge of a square wave (5 Volt, TTL signal, i.e.

Page 87: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

10.3. EXPERIMENTS: C BY RC 87

0 is low and 5 V is high). We will start by using a function generator to generatethe necessary square wave, as we did above for the oscilloscope. Here, we will usethe square wave both to trigger the data acquisition and as the input to the RCcircuit.

The timing sequence of the acquisition is

i. Wait for the trigger (falling edge of TTL signal).

ii. Upon trigger, acquire Nseg samples at interval ∆t.

iii. Display the captured waveform and optionally save to disk.

Triggering on the falling edge, we record only the discharge signal. Implement theabove, and use it to record some charge and discharge curves to disk. They shouldmatch what you saw on the oscilloscope. (The oscilloscope also uses triggering tostart its sweep, so you should already be familiar with this notion.) Decide on anappropriate number of samples Ndata, commenting on the reasons for your choice.

trigger

input signal

RC-decay signal

time

Figure 10.2: Timing schematic showing data captured from a triggered RC decay.

(b) Data analysis (Igor). Now that you have acquired a discharge curve, you cananalyze it by doing a curve fit in Igor to extract the time constant RC. Discussthe difference between the time constant you observe and what you would naivelyexpect, given the nominal R and C values you measured with the DMM. As theprelab suggests, the culprit is the internal impedance of the DAQ. We can sidestepsome of the complexities posed by this internal impedance by using the DMM tomeasure C at some temperature and correlating that measurement with a time-constant measurement in your circuit. Then other time constant measurementscan be expressed as capacitances relative to your original measurement.

3. LabVIEW trigger Because the waveform that we need is so simple, we can easilygenerate it in LabVIEW. Use one of the analog outs of your DAQ (not the one youused to connect to the power amplifier last week) to generate a 0-5 V square to replacethe function generator in the previous step. The program to generate the square wave

Page 88: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

88 CHAPTER 10. BUG 3: RC DECAY

(a While loop with repeated timer and output frames) can run in parallel (i.e., justbelow) the RC-measurement code.

4. LabVIEW curvefit Up to now, you have done curve fits using Igor on data savedto hard disk. In this experiment, it will be extremely convenient to be able to extractthe time constant (proportional to the capacitance) in “real time.” To do this, we canmake use of LabVIEW’s curve-fit capabilities. Unfortunately, those routines are harderto use than the ones in Igor. We help out by supplying a sub-VI that, given startingcoefficients and data, will return the fit and the decay time (in units of the samplingtime interval for the RC data). At this point, you should have a program that, whenrun, will measure one decay time of the capacitor. Verify that the fit routine is workingin LabVIEW by also saving to disk and fitting in Igor. Compare the fits in LabVIEWto those in Igor. Do the inferred time constants agree?

5. Multipass experiment. The preceding gives us single measurements of the decayconstant. However, as we have emphasized in previous labs, it is important to be ableto record data as we vary (and hopefully stabilize) the temperature. As a next step,make a loop and record a series of decay constants as a function of time. Put a timeron the loop and set it to 200 ms/loop. Put in an option to save data to disk.

6. Temperature stabilized capacitance reading. As a last step, for this week, com-bine the temperature control program you wrote last week with the time-constantmeasurement you have just done. (Back-up the working program first!) The basicstrategy is just to use a sequence frame that, in each loop executes the following steps:

(a) Reads Ntemp temperature readings and computes their average.

(b) Uses the PID routine to compute a heater output. (There should be a manual-heater-control option, too.)

(c) Output to heater.

(d) Read Ncap voltage readings across the capacitor, triggered by the downward edgeof a square wave.

(e) Fits the decay data to an exponential and extracts the decay time constant.

(f) Have an optional disk save for time, temperature, power-out, and capacitance.

Although this sounds complicated, basically all you have to do is combine last week’stemperature-control program with this week’s capacitance-measuring program. Thesquare-wave generator should run in parallel with the main While loop, as above.When everything is working, you should be able to adjust the temperature set point toa chosen value and watch the capacitance stabilize (with optional recording to disk).

Finally, set the temperature to 100 C and record to disk several minutes’ worth ofdata. In Igor, plot the temperature, power, and capacitance vs. time. How longdoes the temperature take to relax? What about the heater power? What about thecapacitance?

Page 89: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

Chapter 11

The “Bug,” Part 4: Putting it alltogether – Temperature Dependenceof a Capacitor

11.1 Goals

• Data acquisition: Implement a temperature sweep.

• Data acquisition: Basic notions about state machines.

• Data analysis: Use of a data filter.

• Data analysis: Estimate Tc.

• Measure C(T ).

References

• M. Kahn, “Multilayer ceramic capacitors – materials and manufacture,” technical re-port from AVX Corp., Myrtle Beach, SC (USA). (See course website.)

• M. Trainer, “Ferroelectrics and the Curie-Weiss law,” Eur. J. Phys. 21, 459 (2000).

If you are really curious, here are some advanced references:

• M. E. Lines and A. M. Glass, Principles and Applications of Ferroelectrics and RelatedMaterials, Oxford Univ. Press, Oxford, 1977.

• A. J. Moulson and J. M. Herbert, Electroceramics: Materials, Properties, Applications,2nd ed., John Wiley & Sons, Chichester, 2003.

89

Page 90: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

90 CHAPTER 11. BUG 4: ALL TOGETHER NOW

11.2 Prelab Questions

1. Study the supplied state-machine example from the 6-hour LabVIEW tutorial availablefrom the course website. (Powerpoint presentation, Section X, slides 80-85.) Whenyou have understood the examples there, download the “Lab 11, Starting VI” fromthe course website. Trace through the logic, and make sure you understand what’sgoing on. Ask us for help if not!

2. Write a data-filter program in Igor, along the lines suggested in the text below. Usethe experiment on the course website as a starting point. After writing your data-filterprogram, test it on the sample data, also available from the course website. Overlayon a plot the “raw” data and the “filtered” data.

11.3 Experiments

At long last, we are ready to tackle our problem of measuring C(T ) for the Bug. We startfrom the working LabVIEW program you finished last week to control the temperature Tand to measure the capacitance C by doing a curve fit to data acquired from the triggeredsignal acquisition of the decay of a series RC circuit. Your task this week will be to sweep thetemperature from just above room temperature to 100 C, recording the time, temperature,power, and capacitance. Of course, you can already do this “by hand” by typing in a valueof the setpoint, waiting for the capacitance (time constant) reading to stabilize “enough,”going to the next set point, waiting, etc. Our goal today is to get the computer to do allthis!

1. Data acquisition (LabVIEW: We begin by considering the overall structure ofour program. Figure 11.1 shows a VI that can serve as a starting point. It canbe downloaded from the course website. Note that it has three frames in the mainsequence: an initialization section, the main While loop, and a final section. This is avery common LabVIEW VI structure. We consider each frame in turn.

(a) Initialization. The first step in your program is to initialize variables. We willcome back to this later, but for now, one of the variables that you need to setis the initial temperature setpoint. Initially, you can set this at Tmin (which isdetermined by a control set by the user).

(b) Main loop. The main code that you need to add this week is the control logicto implement the temperature sweep. The general idea is that at the end of eachpass through the While loop, you decide whether to do one of the following:

i. If you’ve taken “enough” data Increment the set point (by an amount dT setby the user via a control). The starting VI gives a convenient way to do this,by counting down repeatedly from some number of cycles. As written, theprogram will cycle once every “Loop T ime (ms)”×Nmax seconds.

Page 91: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

11.3. EXPERIMENTS 91

Lab11, starting vi.virimbaud:Users:bech: current:Phys 231 2006-1:labs 2006-1:Lab11:Lab11, starting vi.viLast modified on 3/4/06 at 8:21 PMPrinted on 3/4/06 at 8:21 PM

Page 1

Nmax Ncurrent

Initialization stuff

goes here, before

the While Loop.

Ncurrent is a local

variable. Here, it is

set to Nmax

Read

Temperature

and average

the readings.

Compute heater

output via PID

and send to

heater. (Or

control manually.)

Read the

RC-decay

data and

then

curvefit to

extact decay

time.

Save time,

temperature,

heater power,

and decay time

to disk.

Ncurrent

Ncurrent Ncurrent

decrement Ncurrent

Execute this when all the

"Compound And" conditions

are true.

True Is Ncurrent > 1?

"Compound And"

Other tests that

you can add...

1

Control Logic Frame

stopLoop Time (ms)

Just for illustration...

Add condition to stop when

temperature > Tmax

Loops

Main While Loop

Output "0 V"

to the heater,

for safety.

Final stuff goes here.

Executed after main

While loop stops.

Nmax Ncurrent

Reset to Ncurrent to

original value (Nmax)

If all conditions are not true,

then Execute this.

False

Figure 11.1: Block diagram of the starting VI, showing the overall structure. The “False”branch of the Case structure is shown below.

ii. If the (new) set point exceeds Tmax (set by a control), or if the user presses a“Stop” button, then stop.

iii. Otherwise, keep everything the same, and execute the next loop.

You may want to also add conditions relating to the stability of the temperatureand/or of the decay-time constant. (Remember, you have these from the PropertyNode history variable.) In other words, the condition for changing the set pointcan be that you wait a minimum time, that the temperature variations in the lastX seconds are less than some value, and that the time-constant variations are lessthan some other value.

One caution is that the capacitance (i.e., the decay constant) can take a VERYlong time to come to its equilibrium value. You’ll have to find some practicalcompromise when choosing the criterion for going to the next set point.

(c) Finishing up. A very important last step is to make sure the heater is OFF,either when the user aborts or when the sweep is finished. Make sure that yououtput a 0-V signal to the heater before stopping.

2. Data analysis (Igor).

The result of running your LabVIEW VI will be the entire set of data points (time,temperature, power, and time constant), taken while the temperature is being variedover the entire range of the experiment. Many of the data points will be “bad” in that

Page 92: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

92 CHAPTER 11. BUG 4: ALL TOGETHER NOW

Total loop time (200 ms)

Acquire Temp.

(20 ms) PID

(~5 ms)Triggered Acquisition of

RC decay (20-60 ms)

Save to disk

(20-50 ms)

Extra time

Curve fit for decay

time (30 ms)

Control logic

(~5 ms)

Figure 11.2: Schematic of the timing in the individual loop, with rough estimates of the timetaken for various activities. Each time through the loop, the program reads the temperature,computes the heater output, waits for the trigger and reads the RC decay, does a curve fitto extract the time constant, writes to disk, and decides whether to change the set point,etc. In order for the timing to be consistent from execution to execution, all this must takeless than 200 ms.

they are taken while the temperature (and other quantities) are changing. If you plotthe raw data for time constant vs. time, for example, you will see all sorts of artifactsthat are associated with this. We can improve things by writing a “data filter” thatwill examine each point, keeping the “good ones” and rejecting the “bad ones.” To dothis, write a program that does the following:

(a) Computes the mean and standard deviation for blocks of Ndec points, for thetime constant and temperature. The syntax is similar to the way we handledblocks in the AC-circuit analysis programs. The mean function is built-in to Igor;you can easily write a standard deviation function using the WaveStats operation,returning the appropriate variable. Make sure you use the /Q flag or you willgenerate lots and lots of text in the history buffer, and the execution will be veryslow.

(b) Applies a filter, in the form of “if the standard deviation of X < Xthresh, keepthe mean value; otherwise reject.” Geek alert: using the “conditional operator”structure from the C language in combination with Igor’s built-in implicit loopsmeans that the filtering can be done with just ONE statement of Igor code!

There is a sample data-filter Igor experiment on the website. Download it and checkit out to see how it works. The program takes a wave and keeps only points betweentwo given values, setting everything else to NaN (“Not a Number”). Note that yourprogram will be somewhat more complicated because your output wave will have afactor of Ndec fewer points than your input wave.

Page 93: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

11.3. EXPERIMENTS 93

The whole notion of a data filter may make you uneasy. Isn’t is bad to “throw away”data? Isn’t there something arbitrary in “choosing filtering criteria”? Well, yes andno. First off, whether you realize it or not, you have always been doing data filtering inevery lab you have ever done. Every time you decide whether to keep a point you havejust measured or try again, you are doing data filtering. Here, we are simply being morehonest in that we keep everything and apply the filter afterwards. While the criteriamay appear arbitrary, we can check whether our conclusions are sensitive to the exactcriteria we choose. If our criteria are too “loose” and we keep too many points, thenthere may be systematic errors because we include points where the temperature ischanging. If our criteria are too “strict” and we keep too few points, we will have largerstatistical errors. Hopefully, there is a range where the choice is not too important. Ifnot, that is a sign that there is a real problem with the experiment.

The above discussion suggests why it is much better to implement the filter in Igoron saved data rather than in LabVIEW “on the fly.” It would be easy to add filterconditions to your VI program to decide each cycle whether to save the data or not.While keeping only “good” data would lead to smaller data files, one would lose someof the raw data and the ability to check whether a different filter would be better orwhether any conclusions are sensitive to the precise choice of filter.

In the final analysis, this philosophy of “keep everything and filter later” has to betempered by practical constraints. For example, in the above experiment, we kept onlythe average of temperature measurements and not the individual readings. Similarly,we kept only the extracted time constants and not the individual decay curves. Keepingall the raw data would have generated huge, cumbersome files. But filtering has thedisadvantage that we must first carefully decide things like the number of temperaturereadings to average each cycle and the number of decay points to measure before fitting.We did this in the preliminary labs from the previous weeks.

3. Running the experiment

Now that you have your LabVIEW and Igor programs working, you are ready totake data! As always, start with a short trial run, to make sure everything works(including the data analysis). When you’re ready, do a real run, going from close toroom temperature (try 30 C) to 100 C, with an adjustable temperature increment.(Choosing 1 C would be nice, but you can use a bigger increment if you are runningout of time.)

If you have time, do a run starting from 100 C and going down to 30 C. (You will haveto make some obvious modifications to your VI. It is easiest, given time constraints,to just make separate increasing and decreasing versions of the VI.) Why are the twoC(T ) curves different? If you had more time, what kinds of experiments might youdo?

With luck (and skill!), you will have seen a big peak in capacitance. Use your DMM todo a one-point calibration of the capacitance, in order to report the capacitance in nF.

Page 94: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

94 CHAPTER 11. BUG 4: ALL TOGETHER NOW

Try to estimate the temperature of the capacitance peak, as well as its width. (Usethe full-width at half-maximum as your criterion.) Again, think about (and commenton) any systematic effects you observe. In order to get a better estimate of the peaktemperature, etc., you might try fitting to some function and then calculating themaximum using the fit coefficients in the analytical function. [For example, if youwanted to estimate the x-intercept of a straight line, you would fit y = mx + b andestimate the intercept by −b/m.]

11.4 Requiem for a Bug

The big peak in the C(T ) plot comes because the material in the capacitor is ferroelectric,and we have crossed a special temperature for ferroelectrics known as the Curie temperature,Tc. A ferroelectric material is the electrical equivalent of a magnet (the “ferro” in ferroelectrichas nothing to do with iron but is coined as an analogy to ferromagnet). The molecules thatmake up the material all have permanent electric dipoles attached to them that can changetheir orientation. The microscopic state of the material is summarized in Fig. 11.3. In (a), athigh temperatures, disorder (entropy) dominates and the dipoles have random direction frompoint to point. In (c), at low temperatures, energy considerations dominate, and the dipolesalign. However, because the material is a polycrystal, there will be small domains, with theorientation in each domain varying from domain to doman. In (b), at a special temperatureknown as the Curie temperature, Tc, there is an intermediate situation bordering betweenorder and disorder. Here, the molecules like to align but they still have some freedom toreorient. The result is large groups of molecules that temporarily align in one direction, andthen another, and another, ... , following a kind of collective motion. The Curie temperatureTc is known as a “phase-transition” temperature, between the disordered “para-electric”phase of high temperature, with no dipole alignment, and the ordered “ferroelectric” phaseat low temperature, with local electric dipole ordering.

What does all of this have to do with capacitance? Well, recall that the charge Q on acapacitor is Q = CV , so that we can think of C as being the amount of charge induced pervoltage (or electric field) applied. In Fig. 11.3(a), an applied E-field will have little effectbecause thermal disorder will fight any ordering effects of the field. In Fig. 11.3(c), theordering of dipoles will also not change much because each crystal grain is locked in placeby all the others. However, in Fig. 11.3(b), at the special Curie temperature, a small fieldcan lead to a significant reordering. We are at the “tipping point” where the molecules arejust about to order, and thus it takes only a small perturbation to decide what that orderingdirection will be. Since a large amount of ordering implies a large charge to the surface, weconclude that at (or near) Tc, we expect the capacitance to become large.

The material we are using is known as barium titanate (BaTiO3), doped with 10% tin(Sn). In pure BaTiO3, the expected C(T ) resembles the form sketched in Fig. 11.4(a). TheCurie temperature is 120 C, which is a bit high to explore in our system. In our impure,“doped” material, the impurities are incorporated into the solid’s crystal lattice. The effectis to have Tc temperatures that are locally shifted by the presence of the nearest impurity

Page 95: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

11.4. REQUIEM FOR A BUG 95

Electric field

(a) (b) (c)

T < TcT ~ TcT > Tc

Figure 11.3: Ferroelectric material in a vertical applied electric field. (a) At high temper-atures (> Tc), the dipoles fluctuate freely, with little interaction with their neighbours andshow little aligning effect from the field. (b) Near the Curie temperature Tc, the dipoles areon the verge of ordering and are very susceptible to being aligned by the field. (c) At lowtemperatures (< Tc), in the ferroelectric phase, the domains with aligned dipoles block eachother from reorienting.

molecules. Thus, one can think of the overall response of the capacitor as the sum of manydifferent response curves, each shifted by a small amount up or down from the “pure” state.The situation is roughly as depicted in Fig. 11.4(b). Summing all those contributions upgives the observed response curve Fig. 11.4(c). The overall transition temperature is lowered,and the peak is broadened.

(a) (b) (c)T

C

Figure 11.4: Capacitance of a ferroelectric material vs. temperature. (a) Response of asingle-crystal. Peak is at the Curie temperature Tc. (b) Individual contributions fromdifferent crystal grains to the capacitance of a polycrystalline material. (c) Overall measuredcapacitance of a polycrystalline ferroelectric material. The individual contributions broadenthe curve and make its shape more like a Gaussian.

An overview of ferroelectric materials, their physics, and their uses may be found at http://www.sou.edu/physics/ferro/nsf wht.htm. Barium titanate mixtures are an importantmaterial industrially. They are used in many types of ceramic capacitors, the most common

Page 96: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

96 CHAPTER 11. BUG 4: ALL TOGETHER NOW

type. In addition, ferroelectric materials have interesting, nonlinear optical properties thatare a key element in communications systems. Our explorations here have just touched onmany of the fascinating properties of BaTiO3. If we had more time, it would be interestingto explore how the capacitance relaxes to equilibrium values at different temperature. Itturns out that the crystal lattice of BaTiO3 is cubic above the Curie temperature andtetragonal below. The change in lattice is accompanied by a change in volume. Thus, as onecrosses the Curie temperature, all sorts of elastic stresses are generated because the Curietemperature is different at different locations in the material. Since stress itself changes thetransition temperature, very complex effects can occur. These are behind the slow relaxationsmentioned. One could also look at things like non-ideal impedance contributions to thecapacitance (there is a small effective resistance, too, whose value depends on frequency).Measuring the charge rather than the voltage across the capacitor also turns out to be aninteresting thing to do. We hope that you will want to go on to explore such issues in afuture course.

As we mentioned at the start of these labs four weeks ago, the Bug experiment has all thefeatures of a modern, computer-controlled experiment, including measurement and controlof the crucial dependent variable (T ), signal averaging, automated sweep, recording to disk,automated data analysis, etc. These are found both in research laboratories and in industrialtesting. If you’ve made it this far, you are in good shape for working in either university orindustry labs.

Page 97: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

Chapter 12

Epilog

Now that the course is done, here again is the “Big Picture” of what we hope you will havelearned. We can schematize the work of an experimentalist by the Figure below.1

Model for experimental investigation While we were working on the goals for our laboratory courses, Steve and I thought that it would be useful to think about how we go about doing experiments, as we hope students will learn how to do experiments during these courses. Then goals at each level can be based on the level of sophistication we expect as students develop these abilities. Here is a simple schematic of what we think of as being standard practice. Please let us know if you know of an official reference for this sort of picture!

Formation of hypothesis

Observation of phenomena

Experimentation

Synthesis of results

Communication of results

Represent data Document

Execute

Design

Analyze

Figure 12.1: Schematic of the experimental process.

1We should say this summarizes the work in an ideal world. In most cases, all of this coexists with themessy reality of everyday life, where we juggle different classes, friends and partner, going to the pub, etc.Somewhere in all of that, experiments do get done!

97

Page 98: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

98 CHAPTER 12. EPILOG

In more detail, what we are hoping you will have acquired at this level is summarizedbelow:

Stage 1: Motivating the experiment based on a hypothesis or observations

• Hypothesis

– Not expected at this level

• Observations

– Able to use standard scientific apparatus (voltmeter, multimeters, oscilloscopes)to measure quantities that are not directly observable (e.g., voltage, current, tem-perature)

Stage 2: Experimentation

• General

– Able to follow instructions for use of scientific equipment

– Able to take a condensed set of instructions and fill in the details with someindependence

• Design

– Able to formulate a plan in advance of the lab period and carry it out flexiblywhen faced with setbacks

– Able to verify that preliminary results are reasonable

– Develops skill at using preliminary results to further refine a measurement

– Understands how to use descriptive statistics (mean, standard deviation, fullwidth at half maximum, rms, etc) to assign a measurement value and assessits uncertainty, and their role experimental design

– Recognizes the basic probability distributions (binomial, Poisson, Gaussian, etc.)and their role in experimental design and scientific inference (measurement ofphysical quantities and their uncertainties)

– Able to use the computer to model functional relationships

• Execution

– Able to leap tall buildings in a single bound

– Able to choose the best method of measurement given two possibilities

– Most data acquisition elements treated as black boxes

Page 99: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

99

– Familiarity with voltmeters, multimeters, oscilloscopes, function generators, powersupplies

– Sensors

∗ Understands role of sensors in converting a physical effect into a voltage

∗ Understands need for calibration and is familiar with basic associated con-cepts

∗ Familiar with basic sensors for temperature (thermocouple), sound (micro-phone), velocity (inductive coupling),

– Analog-to-Digital conversion (A/D)

∗ Able to set appropriate sampling frequency

∗ Signal conditioning able to condition signal to use full dynamic range of A/Dand limit the effects of quantization

∗ Anti-aliasing: use of passive filters to limit bandwidth, some Fourier analysis

– Computer

∗ Able to use data acquisition program

∗ Able to transfer data from one format to another

– Digital-to-analog conversion (D/A)

∗ Familiar with use of voltage to control actuator

∗ Power Amp: use of Power Amp to provide power for actuator

– Actuators: familiar with basic actuators (voltage-controlled frequency generator,heater, etc.)

∗ Representation

– Able to use 2D scatter plots to assess relationships among measured quantities,especially linear, exponential and powerlaw

– Recognizes the role of such relationships in determining physical parameters

– Able to use computer for simple data visualization

– Able to use computer to generate publication quality figures

• Documentation

– Recognizes the value of documenting progress in the experiment in a timely man-ner

• Analysis

– Propagates experimental uncertainties using chain rule

– Brief exposure to the role of matrix algebra in experimental uncertainties

Page 100: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

100 CHAPTER 12. EPILOG

– Understands the role of statistics in quantifying ones knowledge of such relation-ships

∗ Use linear least squares to find parameters and uncertainties

∗ Understand how to use residuals to assess the model, and improve it if nec-essary

∗ Preliminary exposure to the role of matrix algebra in linear least squares

– Able to use standard analysis package to visualize data, compute least squaresfits and related statistics

Stage 3: External communication

• Preparation of formal report based on standard physics paper structure

• Use of standard text formatting programs such as LaTeX

This is a long list and one you will no doubt come back to in other lab courses (in moresophisticated ways). But we hope that by trying to be explicit in what we hope you willlearn, we will make it easier for you to focus on any gaps you may have.

Page 101: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

Chapter 13

Appendix: Programming Concepts

While this is not a programming course, we do end up doing a certain amount of program-ming. In its current incarnation, we are using LabVIEW for data acquisition and Igor fordata analysis. In what follows, we summarize, for reference, the programming concepts etc.that are introduced each week. Numbers refer to the week in the lab course (1-12).

1. LabVIEW : basic metaphors (front panel, block diagrams). Simulate Signal, DAQ

Assistant, Waveform Graph, Write LabVIEW expressVI. Use of a simple control.

Igor : basic metaphors (experiment, wave, history). Graph cursors. Wavestats.

2. LabVIEW : While loop. Stop button. Numerical indicators and controls (includingmeters, etc.). Millisecond timer.

Igor : Defining and plotting a simple numerical function. (Three steps: make a wave;define its x-scaling; and evaluate it for your functional form. The first two are in theData menu (Make Waves and Change Wave Scaling). Use of the Graph options to setrange of axes, change plot type, etc. (You can also doubleclick on axes or traces to dothese.) Dependencies ( ‘=’ vs. ‘:=’ in wave assignments). Taking data by hand andviewing the graph as data are collected.

3. LabVIEW : For loop. Subtleties of Write LVM expressVI (file append, file naming,etc.). Use of DAQ Assistant for counter.

Igor : Functions as programs. Numpnts function. Make operation. Implicit loops withpoint index. Histograms. Monte Carlo: gnoise, pnoise, (and enoise).

4. LabVIEW : timing issue subtleties. (Min. loop ∼ 20 ms.)

Igor : More on functions. Local declarations of waves. FindLevels, DeletePoints,Duplicate operations. Saving graphs / graph macros.

5. LabVIEW : Flat Sequence structure. DAQ Assistant for analog out. Knob control.

101

Page 102: PHYS 231 Lab Manual - Simon Fraser University 041-061/061/Lab_Manual06-1.pdf · 2006. 3. 10. · PHYS 231 Lab Manual Department of Physics Simon Fraser University Last updated: March

102 CHAPTER 13. APPENDIX: PROGRAMMING CONCEPTS

6. LabVIEW : Function node. Passing values in and out of loops.

Igor : Curve fits to pre-defined functions.

7. Continuation of previous week’s lab.

Igor : More on curve fits to user-defined functions.

8. LabVIEW : Calibration of input and output voltages (including look-up table). Case

structure, data tunnels. Statistics Express VI (for mean, standard deviation, etc.).

9. LabVIEW : Property nodes. Sub-VIs. Shift registers. Low-level function node. Data-type conversion (e.g., double → dynamic).

10. LabVIEW : Use of constants (numeric, Boolean). Local variables (read/write). Booleancomparison (AND, OR, >, etc.). Decrementing variables.

11. LabVIEW : Introduction to state-machine concepts. Select node. Absolute-valuefunction. AND gate with multiple inputs.