Administrivia Next Monday is Thanksgiving holiday. Tuesday and Wednesday the lab will be open for make-up labs. Lecture as usual on Thursday. Lab notebooks will be due the week after Thanksgiving, when we will start a new lab (Faraday Effect).
What Is The Goal? The goal of the diode lab is to map out the current-voltage relation of a diode over the largest possible range of parameters. You should try to fit the room-temperature data to the model function over the widest possible range of current and voltage, with the best possible understanding of the behavior of the equipment (noise, offset, etc). You will find that the model agrees with the data within the measurement errors over many orders of magnitude. You will also find that there are some regions where the model disagrees with the data by far more than any reasonable estimate of the measurement errors. You should make plots that emphasize the agreement in various regions of voltage and current (a single plot can t really show everything). You should also make some plots that emphasize the disagreements that you see. For extra credit, you should come up with models of the disagreements, and see how well your model would agree with the level of disagreement that you see.
What Is The Goal (2) For the temperature dependence, the main goal is to study how the I0 and V0 parameters of the data depend on temperature. You should concentrate on the region where the model fits the data well, and exclude the regions where it does not. We have a theoretical prediction for how V0 depends on temperature. You should test that model. You can use the result of this test to determine the ratio of the electron charge q to Boltzmann s Constant k. We didn t talk about the temperature dependence of I0, but it s enormous! The temperature dependence is in fact quite simple, but it s not the same as for V0. You should be able to find the right temperature dependence by doing some book/web research, and your data should be quite consistent with it. The data in prelab4.dat is fake, but it has the right kind of dependence of I0 and V0 on temperature.
Statistical Errors vs Systematic Biases vs Systematic Errors Statistical errors are due to random noise. If you repeat the measurement, the data will look slightly different. If you measure many times and average, then repeat the measure-and-average process many times, the averages will be more consistent than the individual measurements were, by a factor of N. There are other kinds of situations where repeated measurements averaged together don t improve the accuracy. An offset in your measurements is not a statistical error, because repeated measurements will give the same offset. A good term for such things is systematic bias Ideally, you would find problems like offsets and correct them somehow. After the correction, there would be no bias left (but any noise would still be present). Often we are not sure exactly how to correct for the systematic bias because we don t understand it well. This is usually called a systematic error
Systematic Errors There are no standard formulas for determining systematic errors. Some human judgement is always involved. There are two parts of any systematic error contribution the uncertainty of some input number the sensitivity of your result to that input number The input uncertainty is often controversial meaning that you have to make an educated guess about how sure you are about something. The sensitivity part is usually non-controversial meaning that anyone will agree how much your final answer will change if you change the input number. But as always in physics, we don t estimate the systematic errors by the deviation of the result from the theory we are trying to test! If you find some of your data disagrees with the model in a non-random way, outside of the (statistical) error bars, then either there are some systematic errors, or the model is imperfect. When you point out disagreements between model and data, you should make estimates of how large the systematic errors might be, and comment on whether they could plausibly explain the difference, or the model is really in disagreement with any reasonable interpretation of the data.
Other Hints Many people get rather large noise levels in their offset measurements, particularly for the V1 (voltage at the top of the diode) if they were taken by disconnecting the signal generator but leaving the circuit attached to the ADC. If you disconnected both cables from the ADC for the offset measurement, the noise level was pretty low for both channels. It s possible that the noisy V1 offset data is not really appropriate to use. The quieter V2 offset data is OK I think. Your 10 Meg data probably should have been taken at 0.1 Hz (with a slower sample rate). If it wasn t, you probably have two different curves near zero volts. The 10 Meg data taken while the triangle wave voltage was rising is OK; the data while the voltage was falling is not reliable. You can fix this by deleting the falling-voltage data from the file. Remember that you should include the 10 Meg resistance of the ADC in parallel with the circuit resistance. But you should not be making any corrections for the 50 ohm resistor in the output of the signal generator. (Why?)
Gnuplot Hints For Gnuplot on Windows, you can open a DOS window in the current directory by typing shell Then you can show the files in that directory by dir This is also useful for navigating directories. DOS understands cd.. etc. Doing this won t change Gnuplot s default directory, but it can help you find your files and get the path right when you do change the directory from inside Gnuplot You can look at the text in a file by the DOS command more filename Use the Q key to quit out of more You can edit files in a dumb but usable text editor by edit filename The editor pays attention to the mouse for the menu and for cursor positioning I found a way to go up a subdirectory or folder that works on all platforms. Just type cd..
Gnuplot Fitting Reminders You should be doing your fits with errors, meaning not just a column or calculation for x and y, but also a number, column, or calculation for the error fit f(x) file (x):(y):(error) via a,b,c,... The error should be calculated including both vertical and horizontal errors from all sources. You should be checking the reduced chi-square from the fit; it should be of order 1, not hundreds or thousands. You should be looking at residuals, pulls, ratios of data to fit, etc. Gnuplot fitting will work better if you remember to do FIT_START_LAMBDA = 0.01 Check the final lambda value, it should be much less than 1, or the fit isn t reliable (it s not in the final summary, you have scroll back to the previous iteration. Unless the function you are fitting is very simple like a straight line or polynomial, you need good guesses of the parameters for the fit to work. The diode function is quite hard for Gnuplot to fit without good guesses.
A Trick for Guessing Parameters Functions where the fit parameters only occur as coefficients times other functions, like straight lines or polynomials, don t require good guesses. You can define a linear function line(x)=a+b*x and fit it to the log of your data: fit line(x) file using ($1-$3):(log($3/R)) via a,b This converges very quickly, no matter what the initial parameter guesses are. But it doesn t converge to what we want, because all the negative-voltage data pulls the fit: -4-5 'diode.dat' u ($1-$2):(log($2/1000)) line(x) -6-7 -8-9 -10-11 -12-13 -14-10 -8-6 -4-2 0 2
A Trick for Guessing Parameters (2) The fix is to fit to just part of the data. To do this, we include the x range right after the word fit in square brackets. To fit from 0.3 to the upper limit, type fit [0.3:*] line(x) file u ($1-$3):(log($3/R)) via a,b -4 'diode.dat' u ($1-$2):(log($2/1000)) line(x) -6-8 -10-12 -14-16 -18 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 Then convert the fit parameters to the form you need for the non-logarithm version of the fit I0=exp(a) V0=1/b Why still do the non-log fit if this works so well? Because the errors are symmetric on the data, not the log of the data, and this matters for the points near zero, where the positive error is small but the negative error is infinite!
Gnuplot Fitting Problems The diode data for liquid nitrogen is really hard for Gnuplot to fit. (It s even hard for my own fitting program that doesn t have some of the bugs of Gnuplot). The usual symptom is that the fit takes thousands of iterations to converge, and/or the final lambda value is much greater than 1, rather than much less than 1 (lambda is displayed for each iteration, but not in the final summary) On Windows, there is no way that I know of to abort a fit. Pressing the alt key will pause it so you can see what s going on, and alt again will let it start up again. (On Unix or Linux, control-c will stop a fit) It will stop the fit after 100 iterations if you type FIT_MAXITER = 100 You can up-arrow to continue, and do 100-iteration chunks until it converges or you give up. If you do a fit that seems to work, but you get singular matrix errors right at the end, check to see if you are fitting for a parameter (in the via a,b,c,... part of the Gnuplot fit command) that does not appear in your function (it may be a typographical error)
Gnuplot Fitting Problems (2) Gnuplot also has a problems with fits when the relative size of the parameters is too different. For the liquid nitrogen data, the value of I0 is very very tiny, and causes problems. One trick is to re-define your function so the I0 parameter is closer to 1. For instance I(V) = 1.0e-30 * I30 * (exp(v/v0) -1) The I30 parameter will be 1 when the I0 parameter would have been 1.0e-30. The real I0 is 1.0e-30 times the I30 parameter. The error on the real I0 is 1.0e-30 times the (absolute) error on the I30 parameter. The fractional or percent error on I0 is the same as for I30.
Gnuplot Fitting Problems (3) If all else fails, you can use the parameters from the fit to the log of the current, converted to the right units. But, you need to do two extra things to get the errors right. You have to use the errors on the log of the current when you do the fit. The relation between the error of x and the error of the log of x is σ [ log( x) ] = σ [ x] d dx log x ( ) = σ [ x ] And, you need to go from the error on the fit slope and intercept to the errors on I0 and V0. You need σ [ exp( x) ] = σ [ x] d dx exp ( x ) = σ [ x]exp( x) x σ 1 x = σ x [ ] d dx [ ] 1 x = σ x x 2
Gnuplot Save-Files and Load-Files Many students have asked if there was a way to record Gnuplot commands to play them back later. Not exactly. You can type save filename right after making a plot, and the current state of Gnuplot will be written to filename, including functions, variables, and the last plot command. You can later type load filename to recreate the plot (assuming that the data file exists in the right place). Gnuplot commands can also be entered into a file manually using your favorite text editor, then executed by typing load filename For instance, you could make a loadfile that: defined the straight-line function, fit the log of your data over the appropriate range, converted the slope and intercept into I0 and V0, refit the data without the logarithm, and made a plot with the data and the function overlaid. A good way to work is to open an editor in a separate window from Gnuplot, and type all your commands into the editor window. Save the file as filename. Then from the Gnuplot window, all you do is type load filename Just edit the file until it s right, and save it. Then save a copy with a different name and edit that one for the next data file or plot.
Gnuplot Load-Files (2) If you want to have your load-file wait until you are done looking at some intermediate step, include the command pause -1 in the file. For a 3 second delay, use pause 3 Loadfiles can load other loadfiles, so you can make a loadfile that makes a plot then does load printit or even makes several plots each followed by load printit for making several printed pages at once. Blank lines in loadfiles are ignored. Lines starting with # are ignored too, so you can use them as comments, or to suppress execution of lines without deleting them (so you can put them back later). Load-files don t take arguments, but call-files do! call filename arg0 arg1 arg2 and write the call-file using $0, $1, $2 where you want arguments substituted You also have to use $$n rather than $n for column n in plot and fit commands. You may also need to add some quote characters in the call-file. It tends to be easier to edit several slightly different loadfiles for similar data files than to make a call-file that is the same for all the data files that works properly