First Year Experiment 1 Module CY1A2. Introduction to Experimental Techniques Cybernetics is about systems, and these systems need to be analysed and their response determined. This experiment is aimed at introducing some of the concepts behind systems and their analysis, and demonstrating how oscilloscopes can be used to measure systems. Introduction Cybernetics is the science of systems, and these can be electronic, computer based, mechanical, liquid, thermal, biological, economic, environmental, etc. Cybernetists need to be able to analyse systems: for instance, they need to see what the system output is when different inputs are applied to the system. This first experiment examines a simple system and sees what happens when different sinusoids are fed as input to the system. This requires the experimenter to measure the input and output of the system, and this is done using oscilloscopes, which are used in this and other experiments. Hence this experiment provides an introduction to systems, transfer functions, their analysis and oscilloscopes. Transfer Functions Figure 1 shows a very simple system: it has one input and one output. It can represent many different types of system. More complicated systems may have more than one input or output. Input Output Transfer Function Figure 1 Simple System The relationship between the input and output is termed the transfer function: this defines how the input is transferred to the output. Mathematically this can be represented by: Output = TransferFunction * Input This experiment is concerned with a simple electronic system, comprising a resistor and a capacitor. This system is shown in figure 2. Here the input is a voltage, here called vi, and the output is also a voltage, called vo. Note, it is not always the case that the input and output are the same type: for instance the input to a motor might be a voltage, but its output is the velocity at which the motor turns. R Vi C Vo Figure 2 Simple Electronic System The system in figure 2 is known as a low pass filter, often used in audio systems or amplifier systems. When considering such systems we often study their frequency response, that is, we investigate what happens when signals of different frequency are input. Humans can in general hear signals in the frequency range 20Hz to 20,000Hz, where Hz is the SI unit of frequency, 100Hz means a signal repeats 100 times in a second. Given this range, when designing an audio system we need to ensure it operates suitably over that particular frequency range, and we are not that interested what happens when a signal at a lower or higher frequency is input. A low pass filter is one which low frequency signals effectively pass through the filter, but high frequencies do not pass. In this experiment you will see how well this simple electronic circuit acts as a (poor) low pass filter. Sinusoids A signal which has only one frequency associated with it is a sinusoid, also called a sine wave. Thus we use sinusoids when determining the frequency response of a system. Figure 3 shows how a sinusoid varies with time. K sin (ωt) K 1/2f t 1/4f 1/f 3/4f -K Figure 3 Sinusoid, against time The graph actually shows a sinusoid defined mathematically by K sin (ω t) Here t is time; K is the signal amplitude: the signal varies between K and -K; and ω is the 'angular' frequency of the signal: this specifies the rate at which the signal changes. To convert between frequency f (measured in Hz) and angular frequency ω (measured in radians per second, or rad/s) use: ω = 2 π f. Thus, we could describe the sinusoid by K sin (2 π f t) 1 Referring to figure 3, you will see that the size of the sinusoid varies as time changes. When t = 0, the sinusoid has value 0. When t = 1/4f (or t = π/2ω), the sinusoid has amplitude K. When t = 1/2f, the sinusoid has amplitude 0 again. When t = 3/4f the sinusoid has amplitude -K. When t = 1/f the sinusoid has amplitude 0 again. The signal then repeats, increasing to K, before decreasing to -K and then increasing back to 0 when t = 2/f. For example, if the frequency of the sinusoid is 100Hz (or 628 rad/s), its amplitude is K at times 1/400s, 5/400s, 9/400s, and so on: it has amplitude 0 at times 0s, 1/200s, 1/100s, 3/200s, 1/50s, and so on. You may wonder why we use angular frequency, not frequency. One answer is that the function sin is passed a value which is an angle, and that angle can be expressed in terms of degrees, or in terms of radians. It is often the case when analysing systems that it is better to use radians than degrees. If we use a calculator where degrees are used, we find that the sin of 90 degrees, sin(90O), is sin (90) = 1 If we use radians, we get the same answer if we find the sin(π/2) : sin (π/2) = 1 Thus 90O = π/2 radians. Clearly, 360O = 2π radians. Given that sin is passed an angle, we could plot the sinusoid graph with the x axis as an angle, as shown in figure 4. This is a graph of K sin(a), where a is measured in radians.The function is 0 when a = 0, π, 2π, 3π and so on. K sin (a) K 3π π a π /2 2π 3π /2 -K Figure 4 Sinusoid, against angle Sinusoids and Linear Systems A property of simple systems (so called linear systems) such as the circuit used in this experiment is that if its input is a sinusoid, then its output is a sinusoid of the same frequency. There are differences, however: the amplitude of the sinusoids is likely to be different, and the output sinusoid will be delayed by a small amount compared with the input. Figure 5 shows the input and output sinusoids superimposed on one graph. K1 K2 t φ /ω Figure 5 Input and Output Sinusoids The input sinusoid is defined as: K1 sin (ωt) The output sinusoid is defined as: K2 sin (ωt-φ) Here K1 and K2 are the amplitudes of the sinusoids, ω is the angular frequency, as before, and φ is the phase shift. Note, when t = φ/ω, then ω t-φ = 0, so at that time the output sinusoid is K2 sin(0) = 0. We can say that the output sinusoid is delayed, or we can say it is phase shifted, compared with the input. The phase shift is an angle, which is best measured in radians. As we shall see, for our low pass filter, the phase shift changes depending on the angular frequency. The phase shift is one property of a system, the other is its gain and this is defined as the ratio of the amplitudes of the output and input sinusoids. The gain G, which also varies with angular frequency, is G = K2/K1. Theoretical Relationship The relationship between the input and output for the low pass filter is defined by the following two formulae. These define how the gain, G, and the phase shift, φ, vary with angular frequency, ω. Both formulae are also affected by C and R: these are the component values of the capacitor and resistor in the circuit. G= 1 1 + (ωCR) 2 φ = − tan −1 (ωCR) The gain is the reciprocal of a square root, the phase is minus the angle whose tangent is ωCR: tan-1 is sometimes called arctan. Note, the product CR is defined as the time constant of the circuit. Its units are seconds, s. Also, as will be confirmed in the lectures on complex numbers, we can represent the transfer function of the filter as a complex number in terms of ω, C and R. G is the modulus of that complex number and φ its argument. 2 Logarithms and Logarithmic Graphs In this experiment, you will input to the circuit sinusoids whose frequency varies from 100Hz to 100,000 Hz. If you tried to plot a normal graph whose horizontal axis was frequency, that axis would look like that in figure 6. 0 10000 Figure 6 Linear Scaling 100000 Here we see that 90% of the graph covers the frequencies 10,000Hz to 100,000Hz, whereas the frequencies 100Hz to 10,000Hz are crammed into only 10% of the graph. As the information in the range 100 to 1000Hz is just as valuable as that between 1000 and 10,000Hz which is just as valuable as the range 10,000 to 100,000Hz, we need a better way of scaling graphs. This can be done using logarithmic scaling, as shown in figure 7. 100 200 1000 2000 10000 Figure 7 Logarithmic Scaling 100000 Here each 'decade' of frequencies occupies the same amount of space. The log function is used to calculate positions of the data. Note the following properties of the log function, and their consequencies: log(10) = 1 log(ax) = log(a) + log(x) log(xn) = n log(x) log(1/x) = log(x-1) = - log(x) log(1) = log(100) = 0 log(10) = 0 log(10n*x) = n log(10) + log(x) = n+log(x) Consider the straight line graph shown in figure 8, where linear scaling of the axes is used. This is a graph representing the equation y = -x+4, and we are plotting the function -x+4 against x. 4 y 2 x 2 4 Figure 8 Straight Line Graph The gradient or slope of the line is -1, because of the -x term. Suppose we plot a graph of log((ωCR)-1) against log(ω); that is we plot (ωCR)-1 against ω on log scales. This means we are plotting -log(ω) - log(CR) against log(ω). Thus if we replace log(ω) by x, we are plotting a graph of -x - log(CR) against x. When we plotted -x+4 against x we got a straight line with gradient -1. Thus if we plot -log(ω) - log(CR) against log(ω) we should also get a straight line with gradient -1. The significance of this will become apparent later. Gain and Phase plots Suppose we plot the log(G) against log(ω). That means we are plotting log 1 1 + (ωCR) 2 against log(ω ) This does not look useful. But consider the following. Suppose we are testing with a low frequency sinusoid, one such that ωCR is very much less than 1. Then √(1 + (ωCR)2) is very close to 1. For instance if ωCR = 0.01, then √(1 + (ωCR)2) = √(1.0001) = 1.00005, which is very close to 1. Thus we are plotting log(1) against log(ω), and log(1) = 0. Thus at such frequencies the log(gain) against log(ω) is a straight line of value 0. Suppose, however, ωCR is very much greater than 1. Then √(1 + (ωCR)2) is very close to √((ωCR)2) = ωCR. For instance if ωCR = 100, then √(1 + (ωCR)2) = 10001 = 100.005, very close to 100 = ωCR. Hence at such high frequencies we are plotting log(1/ωCR) against log(ω) This, as we have seen, is a straight line with gradient -1. Therefore, at low frequencies the gain graph is a horizontal line, whereas at high frequencies the graph is a straight line of gradient -1. These two straight lines are called the asymptotes, and the actual response starts on the first asymptote but as the frequency increases, the graph moves smoothly away from this and at high frequencies it joins the second asymptote. The two asymptotes meet where ω = 1/CR, or f = 1/(2πCR): this is the corner frequency. The gain and asymptotes are as shown in figure 9. 3 log(Gain) 0 f 100 1000 Figure 9 Gain Response 10000 As regards the phase graph, at low frequencies φ is approximately -tan-1(0) = 0. At high frequencies φ is approximately -tan-1(ωCR) = -tan-1(large number) = -π/2 The phase response is shown in figure 10. It starts near 0 rads and end near π/2 rads, changing smoothly between these two values. It is π/4 rads at the corner frequency. φ 0 -π /2 f 100 1000 Figure 10 Phase Response 10000 In figures 9 and 10, the corner frequency is 2000Hz, that is 12566 rad/s. Thus the time constant, CR, is 1/12566 = 79.57 10-6s. Experiment You are provided with an oscillator, which generates sinusoids at different frequencies, the low pass filter and an oscilloscope (CRO), with two channels A and B. Connect the oscillator to the input of the filter and to channel A and connect the filter output to channel B. Also, connect the earth of the oscillator to that of the filter and the CRO. Set the trigger control of the CRO to be 'Auto' and 'Beam A'. Set the input ranges of both channels to be 1V/cm and the timebase to be 0.2 ms/cm. Adjust the oscillator so its frequency is 1000Hz (1kHz) and the amplitude is +/- 3V. Look at the CRO: do you see two sinusoids of the same frequency with the smaller sinusoid delayed compared with the other? Is the frequency of the sinusoids correct? See what happens when you change the input channels and time base on the CRO. Change the frequency of the oscillator and adjust the CRO so you get a suitable picture. Record in your log book everything you do. You will now use the CRO to measure the gain and phase shift of the filter at different frequencies. To measure these at any given frequency you must keep the time base the same for both channels, and it is best to adjust the other controls so that the sinusoids are big enough to fit on the screen. To measure gain, read from the CRO the amplitude of both sinusoids (remember to take into account the vertical scaling on the CRO): the gain is the ratio of the two amplitudes. To measure phase, adjust the time base so that one period of the sinusoid occupies 100mm, and if x is the horizontal distance (in mm) between the two sinusoids, the phase shift in radians is found by x * π / 50. [Note, it is π / 50 because 2π rad = 100mm, so 1mm = π / 50 rad.]. Produce a table, which you write in your log book, recording for each frequency the gain and phase of the circuit. Start at frequency 100Hz, and then repeat measurements at 200Hz, 400Hz, 800Hz, 1600Hz, and so on: do not exceed 100000Hz. Look at your results as you find them: as the frequency increases, so the gain should decrease and the phase shift increase, if they do not, check your results. Plot a graph of log(Gain) against log(Freq) and a graph of phase against log(Freq). Use log-log paper for the gain graph and log-linear paper for the phase graph. Do they have the same shape as the theoretical graphs above? If not, check your measurements. Try to fit the straight line asymptotes to the gain curve. These should meet at the corner frequency: so what is the time constant CR? Check your value of corner frequency by seeing if the gain at that frequency is 1/√2 = 0.71. Is the phase shift at this frequency -π/4 rads? Write a conclusion stating briefly what you have found out in the experiment and comment on how well this circuit acts as a low pass filter. RJM 16/02/04 4