CHAPTER 5 INTRODUCTION TO SYSTEMS AND FREQUENCY RESPONSE FUNCTIONS When we model the behavior of measurement systems we often break down the system into components that are connected together in series. These components are typically transducers, amplifiers, bridge circuits, demodulation devices, filters, analog to digital converters, oscilloscopes and computers. Many of these components can be modeled with very simple linear ordinary differential equations. Typically we use first and second order differential equations to model these components. If the system is well designed, then it is very straightforward to take models of the components and combine them to derive a model of the whole measurement system. In this chapter the solution of linear ordinary differential equations will be reviewed, and we will introduce the terminology commonly used in instrumentation to describe the response of these equations. By using the response to sinusoidal excitation, we will also describe what is meant by the System's Frequency Response and we will show how this can be used to predict what happens when any sinusoidal excitation is inputted to the system. We will concentrate on two types of excitation: a step input which is what happens when we move from one constant input to another constant input, and a sinusoidal input, which is the simplest dynamic input to study. In Chapter 8 we will show how to take complicated signals and break them down in a sum of sinewaves. The building blocks we use in this chapter will be used again to predict the response of systems to these more complicated inputs. Throughout our analysis we will be assuming that the system is linear. Having performed our calibration (Chapter 2), we should know that we are operating in a region where the system can be modeled as a linear system. One property of linear systems that we will use is that of superposition. Suppose we put two separate signals, x1 and x 2 into the measurement system or a component of the measurement system. Further suppose that the responses were y1 and y 2 , respectively. Now, if the input to the system is a combination of x1 (t) and x 2 (t) : x(t) x1 (t) x 2 (t) , (1a) y(t) y1 (t) y 2 (t) , (1b) then the output will be: where and are constants. Another property of linear systems is observed when a sinusoidal excitation is input into the system. The steady state response is a sinewave of the same frequency, though the amplitude and phase may be changed by the system. Input: x(t) = A sin 1t , Output: y(t) = B sin ( 1 t+ ) . 5-2 Before considering the differential equation models, we will revise some complex notation that we will use. While seeming more abstract, the complex notation approach will simplify the mathematics considerably and help you solve the equations much faster. Finally having considered models of components, we will show how, under certain conditions, we can take the frequency response functions of the individual components and multiply them together to produce an overall frequency response function for the entire system. REVISION OF COMPLEX NOTATION 1 . A complex variable z can be written in two ways: We will use j to denotes the z x Ae j , jy (2) where x, y, A and are all real. x is the real part of z, denoted by Real(z), and y is called the imaginary part of x, denoted by Imag(z). A is called the magnitude, the modulus or the amplitude, and is denoted by z . is the phase, sometimes denoted by Arg(z). A pictorial representation of z is shown in Figure 1. Imaginary x z A y Real Figure 1: Representation of a complex variable on an Argand diagram. From the diagram, using simple trigonometry we can see that: A2 x2 x A cos y2 , tan 1 y , x (3a and b) , (3c and d) and , y A sin 5-3 Sines and Cosines Using this notation we can split up sines and cosines into exponentials. From equations (2) and (3c and d) we can see that: ej t e j t cos t (4a) j sin t , and similarly, cos t (4b) j sin t , Note that we have set to equal t. This is just to be consistent with the way we will see the sines and cosines appear later on. Adding equations (4a) and (4b) and dividing by two gives: 1 j e 2 t 1 e 2 j t cos t . (5a) Subtracting equations (4a) and (4b) and dividing by 2j gives: 1 j e 2j t 1 e 2j j t (5b) sin t . We will use this decomposition of sines and cosines into two complex exponentials later on in this chapter. Differentiating and Integrating In the simple use that we will make of complex variables, we can usually just treat j as a constant. So if we differentiate exp( j t ) with respect to t, we will obtain: d j e dt t j ej t , (6a) Similarly, if we integrate we will get: t j t e dt 0 ej j t t 0 ej j t 1 . j (6b) Notice, as always, the introduction of the constant (1/ j , in this case) after substituting in the initial condition at t = 0. 5-4 Functions of Complex Variables Consider the complex function, F(z). Using z = x + jy, we can express F(z) in its real and imaginary form thus: F(z) where u, v, A and u(x, y) A(x, y) e j j v(x, y) (x,y) , (7) are real functions of x and y. Often in this course, the complex function we are considering will be something we call a frequency response function and is typically a function of frequency, . If you wish, you could think of this as having come from a function of a complex variable, x + jy, where x = 0 and y = . We most often look at this function in its modulus and phase form, and typically, the form of the complex function is a polynomial in j divided by a polynomial in j . For example: bo b1( j ) 1 a1( j ) a 2 ( j )2 bo (1 a 2 jb1 ) ja1 (8) . 2 When calculating the magnitude and phase of this function, it is easier to put the numerator and denominator into magnitude and phase form and use the relationship: B ej b A ej a B j( e A a) b . (9) Following from this, the example complex function's magnitude and phase are: Magnitude b2o (b1 )2 2 2 (1 a 2 ) (a1 ) 2 Phase tan b1 bo 1 tan 1 a1 1 a2 2 . (10) Complex Conjugates The complex conjugate of a complex quantity is found by replacing j by -j in the quantity. So if we have: f u jv Ae j , f* u jv Ae j . (11) Notice that we use a * to denote the complex conjugate. Also, taking the conjugate has no effect on the magnitude (A) and changes the sign of the phase. Multiplying a complex quantity by its complex conjugate gives: f f* u2 v2 A2 . 5-5 Use the expressions in (11) to prove this result. Example If T = (2 + 4j)/(1 - 3j), calculate the magnitude, the phase and the complex conjugate of T. Solution Magnitude = Magnitude of top / Magnitude of bottom. Magnitude2 (22 42 ) /(12 ( 3)2 ) 20 /10 2 Magnitude = 2 1.414 Phase = Phase of the top - Phase of the bottom. Phase = tan 1(4 / 2) tan 1( 3/1) tan 1 2 tan 1 3 2.356 rads 135 Complex conjugate: replace j by -j. (2-4j)/(1+3j) = 1.414 e j2.356 . Using MATLAB to Evaluate Complex Functions When you are evaluating complex functions, MATLAB understands j or i to mean 1 , unless you use those letters to denote another variable. It will also calculate the magnitude (abs) and phase (phase). Below is an m-file example of how to evaluate the function above. %ch4ex1.m program to evaluate a given complex function % %Specify coefficients b0=1;b1=0.9; a1=0.25;a2=0.01; omega=input('Input frequency at which you wish to evaluate function ') F=(b0+j*omega*b1)/(1-omega*omega*a2+j*omega*a1); [abs(F) phase(F)] We can also plot this as a function of for a set of values of . Suppose we wanted to plot the function for 0 to 100 in steps of 0.5 rad/s. The m-file for this would be: %ch4ex2.m program to evaluate a given complex function and plot. % %Specify coefficients b0=1;b1=0.9;a1=0.25;a2=0.01; % %Specify omega omega=(0:0.5:100); % %Evaluate the function, notice the use of the "." to specify %element by element calculations. F=(b0+j*omega*b1)./(1-omega.*omega*a2+j*omega*a1); % %Now plot the magnitude in dB and the phase in degrees. subplot(211); plot(omega,20*log10(abs(F))); 5-6 xlabel('Frequency rad/s') ylabel('Magnitude in dB') title('Example Frequency Response') subplot(212) plot(omega,phase(F)*180/pi) ylabel('Phase in degrees') xlabel('Frequency rad/s') The result of running this m-file is shown in Figure 2. Figure 2: Plot of a complex function, magnitude and phase 5-7 SOLUTIONS OF ORDINARY DIFFERENTIAL EQUATIONS The modeling of the components in the measurement system will usually lead to linear, ordinary differential equations. The most general form of such an equation is: an dny dt n an d n 1y 1 dt n 1 a1 dy dt y bm d mx dt m bm d m 1x 1 dt m 1 b1 dx dt box(t) (13) y is the response of the measurement system component, x is the input to the measurement system component, n is the order of the system. Many measurement system components can be modeled by either first or second order differential equations. For example: dy(t) y(t) K x(t) (14) dt could be an equation that models the dynamic behavior of a thermocouple. is called the time constant and is related to how quickly the system responds, and K is the static sensitivity, which is an indication of the gain of the system. In this example its units would be V/ C. It is the same as the sensitivity calculated from the static calibration. 1 d2 y(t) 2 dt 2 n 2 dy(t) dt n y(t) K x(t) (15) could be the differential equation of a strain-gage accelerometer. n is called the natural frequency, is called the damping ratio, and K is again the static sensitivity. n and affect how quickly the system responds and how quickly it settles down after a perturbation. How do we find y(t) if we know x(t)? There are two parts to the solution, which come from the superposition principle. The input, x(t), can be thought of as x(t) + 0.0, and so we need to find a solution with the right hand side as given, and add to it the solution with the terms involving x(t) set to 0. Since by convention we put all the terms in x(t) on the right hand side (RHS) of the equation, then this second solution is formed by setting the RHS to zero. The first solution is called the particular solution, and will have a form very similar to x(t). The second solution is called the homogeneous solution. The homogeneous solution will involve some unknown constants (number equal to the order of the system), which are found by substituting known initial conditions into the final solution. So the solution steps are outlined below. Also given is the measurement systems terminology for the particular and homogeneous solutions. 5-8 Stage 1: Particular Solution (Steady State Solution) Pick a solution that looks like the function x(t) but is in its most general form. For example: If x(t) = A cos 5 t , then choose yp (t) B cos (5 t ). So here the solution has the same frequency of the input but has undergone an amplitude and a phase change. B and are found by substituting the expressions for x(t) and y(t) into the differential equation and comparing coefficients. Another example: If x(t) = t 2 then choose y p (t) ao a1t a 2 t 2 . Again substitute into the differential equation and compare coefficients. Stage 2: Homogeneous Solution (Transient Solution) Set the RHS of the differential equation to zero. Choose a solution of the form: yh (t) e t (16) Substitute into the differential equation (RHS = 0), and divide by e t . This will yield a polynomial in . Consider equation (13) as an example. The resulting polynomial will be: an n an n 1 a1 1 (17) 1 0 Use a root solver on the computer to find the roots. Let's denote these by: 1, 2, n. There are actually n possible homogeneous solutions and we combine them to form the full homogeneous part of the solution. Since these are all solutions to an excitation of 0, we can multiply them by constants, which we will need to determine. So, y h (t) Stage 3: A1 e 1t A2 e 2t A3 e 3t An e nt Total Solution To form the total solution, add the particular and the homogeneous solution. In measurement language, add the steady state and the transient solution. (18) 5-9 y(t) ysteady state Stage 4: (19) yp (t) yh (t) ytransient Evaluating the constants from initial conditions To find the total solution you need to evaluate the constants that arose in the homogeneous solution. Initial conditions are conditions given at t = 0. You need n initial conditions, where n is the order of the system. We assume that we know x(t), the input, for all time, t. 1st Order system: 2nd Order system: 3rd Order system: etc. y(0) should be known. y(0) and y(0) should be known. y(0), y(0) and y(0) should be known. So take your total solution and differentiate it (n-1) times, substitute in t = 0 and equate to known initial conditions. You should now have n equations and n unknowns. Solve for A1, A 2 , A n . Example Consider a thermocouple with a time constant of .1 seconds and a static sensitivity of 3 mV/ C. Initially the output is 0.01 Volt. The temperature is suddenly changed to 100 C? What would the response be? Solution The differential equation is: dy dt y Kx where t = 0s. 0.1 and K Stage 1: The input is a constant and so the steady state solution (particular solution) will also be a constant. Set y = C and substitute into the above differential equation. When we differentiate a constant the result will be zero. The input is 100 after t = 0s. Hence, C Stage 2: 0.003V/ C . Let's assume that the temperature change occurred at time: K 100 0.3Volts. Hence, ysteady state =0.3Volts. Set the RHS of the differential equation to 0. Assume a solution of the form e t and substitute into the homogeneous form of the differential equation. Divide through by e t . This results in 1 0. Hence, 1 1 0.1 10. 5-10 The transient solution (homogeneous solution) is therefore: t y transient Stage 3: Ae 10t The total solution is the sum of the transient and steady state solutions: y(t) Stage 4: Ae 0.3 Ae 10t The initial condition (only one needed because its a 1st order system) is y(0) = 0.01 Volts. From the expression for the total solution with t = 0 substituted in, we see that, 0.01 = 0.3 + A, implying that A = - 0.29. The total solution is therefore: y(t) 0.3 0.29e 10t Volts, for t 0, and y(t) = 0.01 Volts for t < 0. The response of this system is shown in Figure 3. Figure 3: The response of a first order system to be a step change in constant input 5-11 Example: Including bias effects Suppose that a thermocouple similar to the one in the previous example is being used. The time constant of .1 seconds and a static sensitivity of 3 mV/ C. Initially the output was 0.01 Volt when the temperature was 18 C. The temperature is suddenly changed to 100 C? What would the response be? Solution Note that K.18 = 0.054 does not equal 0.01 Volts, i.e., there is a bias in the measurement system. The differential equation describing this system is: dy y b Kx dt where 0.1 and K = 0.003V/ C. b is the bias, which we can determine from knowing that the output was a constant 0.01 Volts when the temperature was 18 C, prior to the step input. From the differential equation, this gives: 0.01 b 0.003 18 Volts Which yields b = 0.044. We can follow the same solution strategy as before if we do a substitution of variables: z = y – b. Because b is a constant, z y . The differential equation in z is therefore: dz dt Stage 1: z K x. The input is a constant and so the steady state solution (particular solution) will also be a constant. Set z = C and substitute into the above differential equation. When we differentiate a constant the result will be zero. The input is 100 C after t = 0s. Hence, C = K 100 = 0.3 Volts. Hence, zsteady state Stage 2: 0.3 Volts . Set the RHS of the differential equation to 0. Assume a solution of the form e t and substitute into the homogeneous form of the differential equation. Divide through by e t . This results in The transient solution (homogeneous solution) is therefore: z transient Stage 3: Ae 10t The total solution is the sum of the transient and steady state solutions: z(t) 0.3 A e 10t . 5-12 Stage 4: The initial condition (only one needed because it’s a 1st order system) is y(0) = 0.01 Volts and hence z(0) = 0.054. From the expression for the total solution with t=0 substituted in, we see that, 0.054 = 0.3 + A, implying that A = - 0.246 . The total solution is therefore: y(t) b z(t) 0.044 0.3 0.246 e 10t Volts,for t 0. and y(t) = 0.01 Volts for t < 0. Example An LRC circuit can be modeled as a 2nd order differential equation with a natural frequency of 1000 rad/s and a damping ratio of 0.01. In a calibration test the sensitivity was found to be 2 Volts/Volt. Before t = 0s the input is a constant voltage of 0 Volts. At t = 0 the input is changed to a sinusoidal voltage of amplitude 6 Volts peak to peak and of frequency 10 Hz: 3 sin(100 t). Calculate the response. Solution The differential equation describing this system is equation (15): 1 d 2 y(t) 2 dt 2 n 2 dy(t) n dt y(t) K x(t) which becomes, after substituting in the values for the natural frequency, damping ratio and sensitivity, d 2 y(t) dy(t) 2 10 5 y(t) 2 x(t) 2 dt dt We can approach forming the steady state solution in two ways: (1) Assume a solution of the form: B sin (100 t ) and substitute into the differential equation. Compare the coefficients of sin(100 t ) and of cos(100 t ) to find B and . 10 Stage 1 6 (2) Recognize that we can split the sine into two exponentials: x(t) 3 j100 e 2j t 3 e 2j j100 t 5-13 and using the principle of superposition, we can calculate the response to each exponential separately. We can then combine them to form ysteady state (t). We will adopt the second approach here, because we use a similar approach when determining system frequency response functions. For ease of notation, let 100 x(t) e j t produces y(t) T1 e j t ,T1 may be complex. 3 j e 2j Hence: x(t) x(t) e j t t j t produces y(t) T2 e 3 e 2j hence: x(t) 3 T1 e j 2j produces y(t) j t t . , 3 T2 e 2j produces y(t) j t . Therefore, x(t) = 3sin( t) produces ysteady state (t) 3 T1 e j 2j 3 T2 e 2j t j t , We need to find T1 and T2 . Substituting x(t) ej t T1 e j , y(t) t into the differential equation gives: T1 10 6 ( j )2 2 10 5 (j ) 1 ej t 2 ej t , leading to: T1 2 10 Recall that T1 6 (j ) 2 2 10 5 . (j ) 1 is 100 . Substitution into the above equation yields: 2 1 0.0987 j 0.0063 . The response to the first exponential is: . 5-14 3 T1 e j100 2j ysteady state1 t Following exactly the same procedure for x(t) e T2 2 6 10 ( j ) 2 2 10 5 j t and y(t) T2 e j t we get: T1*. ( j ) 1 That is, T2 is the complex conjugate of T1 . 3 * T1 e 2j ysteady state2 j100 t . Combining the two solutions gives: ysteady state 3 T1 sin(100 t phase(T1 ) ), where: T1 6.66 phase(T1 ) Stage 2: tan 1 0.0063 0.9013 0.007 radians. Now we form the homogeneous or transient solution. Set x terms to 0, assume a solution of the form e t , substitute into the equation, and divide through by e t . This yields: 10 6 2 2 10 5 1 0. The roots of this are: 1,2 10 100 1,000,000 10 j999.95 Therefore the transient (homogeneous) solution is: y transient Stage 3: A1e( 10 j999.95) t A 2e ( 10 j999.95) t The total solution is the sum of the steady state and transient solutions. y(t) 6.66sin(100 t 0.007) A1e( 10 j999.95) t A2e( 10 j999.95) t 5-15 Stage 4: Now use the initial conditions. The system was at rest prior to the application of the sinusoidal input and so y(0) and y(0) both equal 0. This leads to the two equations: 0 0 6.66 sin( 0.007) A1 A 2 666 cos( 0.007) ( 10 j999.95) A1 ( 10 A1* and that: Solving these equations, we find that A2 A1 1.046 e j1.549 , A2 1.046e j1.549 j999.95) A 2 . . To do this calculation you could use the following MATLAB m-file. ch4ex3.m Program to solve two simultaneous equations. % y = [ 6.66*sin(0.007) , -666*pi*cos(0.007) ]'; X = [ 1 1 -10+j*999.95 , -10-j*999.95 ]; a=X\y Combining these exponential terms we obtain a damped cosine wave. y transient 2.092e 10t 2.092 e 10t 1 j(999.95 t e 2 1 e 2 1.549) j(999.95 t 1.549) , and hence y transient cos(999.95t 1.549). The total solution is therefore: y(t) 6.66sin(100 t 0.007) 2.092 e 10t cos(999.95t 1.549). The response of this system is shown in Figure 4. 5-16 Figure 4: The response of a second order system to a sinusoidal excitation, turned on at t = 0. (top) Total solution, (middle) transient solution, (bottom) steady state solution. 5-17 FREQUENCY RESPONSE FUNCTIONS When characterizing the behavior of measurement systems, we are interested in whether they can respond fast enough to track the signals we wish to measure. The faster the fluctuations in a signal, the higher the frequencies are in the signals. This is illustrated in Figure 5. Figure 5: (a) Slower fluctuations, e.g. a 5 Hz sine wave, (b) faster fluctuations, e.g., a 100 Hz sine wave To characterize this, we examine how the steady state response of the system varies with the frequency of a sine wave input. The system will affect the amplitude and the phase of the sinewave and hence if the input is x(t) Asin( t ), (20) the output will be y(t) A T sin( t phase(T)). (21) T e j phase(T) is complex and varies with . We often write it as T( j ) to emphasize this frequency dependence. | T | is the magnitude of what is called the frequency response function and phase (T) is the phase of the frequency response function. T It will become clear that knowledge of T( j ) will give us complete knowledge of the system. That is, if we know T( j ) , we can also write down the differential equation model of the measurement system. For the types of measurement system components we are interested in T( j ) is often in the form: 5-18 T( j ) bo b1( j ) b2 ( j )2 1 a1( j ) a 2 ( j )2 b NB ( j ) NB a NB ( j ) NA (22) Furthermore, NB = 0 or 1 and NA = 1, 2 or 3, are typically values for the types of measurement component systems that we study. The Ideal Frequency Response Function Before going on to calculate frequency response functions, let us discuss what its ideal properties would be. Ideally we would like the shape of the input signal, x(t), to be preserved as it passes through the measurement system. This means that we do not mind if x(t) is scaled or time shifted, but all frequency components present in the signal must be affected in the same way, i.e., ideally: y(t) K x(t t o ) , where t o is the delay and K is a constant. If we plotted the ideal frequency response gain versus frequency, it would be a constant. How does the time delay affect the phase of each frequency component? If, x(T) A sin( t) , then y(t) K Asin( t to) (23) The time delay introduces a phase that is a linear function of frequency: an ideal frequency response function is either 0 (t o t o . So the phase of 0) or a linear function of frequency. It is unlikely that a system would exhibit these ideal characteristics for all frequencies. When we purchase or develop our own measurement system we look for the region of frequencies where these ideal characteristics are almost satisfied. We define that region as the operating frequency range of the measurement system. That is, all frequency components in the signals we wish to measure should lie in that region. Calculating the Frequency Response Function from the Differential Equation We will derive this frequency response function for the general system model (without bias) as given in equation (13). We adopt an approach seen in a previous example where we split a sinewave excitation into two complex exponential terms. Consider only one of the exponentials: y(t) x(t) e j t , and denote the steady state response by T e j t . Alternatively, we could consider the steady state response of the system to an excitation x(t) X e j t to be y(t) Y e j t . Because this is a linear system and the excitation is a single frequency, we know that Y = X.T, and hence we can find T, the frequency response 5-19 function of the system, from Y/X. Substitute these expressions for x(t) and y(t) into equation (13). a n ( j )n Y e j t a n 1( j ) n 1 Y e j t Yej t b oX e j b1( j )Xe j t bm ( j )m Xe j t t Comparing coefficients of e j t and collecting terms in Y and X we obtain a n ( j )n a n 1( j ) n 1 a n 2 ( j )n n 2 a1( j ) 1 Y bo b1( j ) bm ( j ) m X Dividing by X times the polynomial in the brackets in front of Y, we can express T, the system frequency response function, as: T( j ) Y X bo b1( j ) b2 ( j )2 1 a1( j ) a 2 ( j )2 bm ( j ) m a n ( j )n (24) Derivatives in the Differential Equation and (jω) Terms in the Frequency Response Function Each time we took a derivative of e j t we increased the power of the (jω) in the term. dmy dt ( j )m Y e j t So by seeing a term 6( j )5 , which is equal to 6j 5 etc. (25) , in the denominator of the frequency 5 d y term in the differential equation. Similarly, if dt 5 we see a term 2.3 2 , which is equal to –2.3 ( j )2 , in the numerator of the frequency response response function we know that there was a 6 function we know that there was a 2.3 d2x term on the RHS of the differential equation. dt 2 Example What is the differential equation model relating the excitation, f(t), to the response, z(t), of a linear system, if the frequency response function, H( j ) , is given by: 4j 1 2 3 0.02 j . 5-20 Solution Expressing f(t) and z(t) as Fe j t and Ze j t , respectively, then H( j ) 2 1 Z ej t Z ej 0.02 j ( j )2 Z e j t t 0.02( j ) Z e j Z / F. Therefore: 4j 3 F ej t . t 4( j ) F e j t 3 F ej t . Therefore the differential equation is: z z 0.02z 3f . 4f Response to sine waves If we have an input e j e j 1t 1t , the response is T( j 1) e j 1t . By similar argument, if we have an input , the response is T( j 1) e j 1t T( j * 1) e j 1t T( j 1) e j phase(T( j 1)) e j 1t , where * denotes complex conjugate. So the response to x(t) B sin( 1t (26) ) is the sum of the responses to B j j e e 2j 1t and B e 2j j e j 1t which is y(t) T( j 1) B j j phase(T( j 1)) j 1t e e e 2j T( j 1) B j e e j phase(T( j 1))e j 1t 2j Combining these complex exponentials into a sinewave we have y(t) T( j 1) Bsin 1t phase(T( j 1)) . (27) The frequency response function tells us how the amplitude and phase of a sinewave change as the sinewave passes through a system. So once we have the frequency response function, the steady state response of the system, to any sinusoidal excitation, can be calculated. Example 5-21 Calculate the steady state response to x(t) = 3 sin 100t of the system whose behavior is described by: 5y y 40x Solution Step 1: Calculate the frequency response function, G( j ). Let x(t) X e j t and y(t) 5( j )Y e j t Y X G( j ) Step 2: 100 rad/s. 40 1 j 500 Calculate the Magnitude and Phase of G( j100). 40 G( j100) 2 1 phase (G( j100)) Step 4: 40 X e j t 40 5j 1 Evaluate G( j ) at G( j100) Step 3: Yej t Y e j t . Substitute into the differential equation. 2 500 1 0.0800 2 500 0 tan 1 1 1.5688 rads. Write down the steady state response to x(t) = 3 sin 100t. y(t) 3 0.0800sin(100t 1.5688) 0.2400sin(100t 1.5688). Example The frequency response of a thermocouple plus an AC amplifier measurement system is T( j ) (1 K 3j 1 j ) (1 2 j ) (1 j 3 ) (28) (a) What was the differential equation model of the system? (b) What is the steady state response of this system to a sinusoidal fluctuation about a mean temperature, x(t) 20 5sin 30t C 5-22 Solution (a) Expand factors in the frequency response function and multiply both sides of (28) by the denominator of the frequency response function. 1 ( 1 2 3) j ( 1 2 2 3 1 3 )( j )2 ( 1 2 3 )( j )3 Y X K 3( j ) Multiply both sides by X e j t and use the results shown in equation (22) to give the differential equation: y ( 1 dy ( 1 2 3) dt 2 2 3 1 3) d2y dt 2 d3y 1 2 3 dt K 3 2 (b) Split this input up into the steady state response to the constant: x1(t) dx dt 20 C and the steady state response to the sinewave: x 2 (t) 5sin 30t C, giving y1(t) and y2 (t) , respectively. The total steady state response is then y1(t) y2 (t) Steady state response to x1(t) Either, consider x1(t) to be 20 cos t where y1(t) 20 T( j0) cos(0t phase (T(0)) 0, hence the steady state response is dx 0 and that the steady state 0. Or, notice that dt response to a constant is a constant, and therefore dmy 0 for all m 1. So the L.H.S. of the dt m differential equation becomes y and the right hand side is zero, giving a solution y1 0. Steady state response to x 2 (t) Here the frequency is 30 rad/s so the steady state response is y2 (t) 5 T( j30) sin(30t phase(T( j30))) Evaluate the T( j ) at 30 rad/s, the frequency of the excitation. T( j30) T( j30) (1 K 3 j30 1 j30) (1 2 j30) (1 j 3 30) 30 K 3 1 1 1 1 (30 1)2 2 1 (30 2 )2 2 1 (30 3 )2 2 phase(T(j30)) = phase (top) – phase (bottom) 5-23 30 3 tan 1 0 2 (tan 1 30 1 tan 1 30 2 (tan 1 30 1 tan 1 30 2 tan 1 30 3 ) tan 1 30 3 ) Note that we calculated the phase of each of the factors in the denominator: phase{1 j tan 1 i} i 1 and summed them up. This is faster than expanding out the denominator. We are using the property of products of complex variables. If z i z1z 2z 3 A1e j 1 A 2e j 2 A 3e j Aie j i then (A1A 2A 3 )e j( 3 so z1z 2z3 A1A2A3 i.e., z1 z 2 z3 and phase(z1z 2z 3 ) phase(z1) phase(z2 ) phase(z3). 1 1 2 3) 2 3 i.e., So the total response is y(t) y1(t) y2 (t) 0 5 T( j30) sin 30t phase(t( j30)) where T( j30) and phase(T( j30)) are given above. Example An accelerometer can be modeled as a second order system: m d2v dt 2 c dv dt kv Ba (29) where v is the output voltage and a is the acceleration. m, c and k are the physical properties of the accelerometer: mass, damping coefficient and stiffness respectively. (a) What is the natural frequency, damping ratio and sensitivity of the accelerometer? (b) Calculate the frequency response function. (c) Plot the frequency response function. Plot the magnitude in dB, the phase in degrees and plot both against a log frequency axis. This allows us to better see trends and makes it easier to combine plots of different frequency response functions. Decibels (dB) are defined as 20 log10 (magnitude). 5-24 Plot over a range that highlights all the features of the frequency response function. Choose .7, .1, and .001 and K 10mV/(m/s2 ). n 10,000 rad/s, Solution (a) The standard form for a second order differential equation is 1 d 2 v(t) 2 n dt 2 dv(t) n dt 2 v(t) (30) K a(t) where n is the undamped natural frequency, is the damping ratio and K is the sensitivity. To put (28) in this form divide through by k. Equating coefficients we get: m k Therefore n k m 1 2 n c n 2k c k , c 2 km 2 B k and n K B . k and K (b) To calculate the frequency response function assume that a(t) A e j t and v(t) V e j t . The frequency response function is then given by T = V/A. Substitute into (30) to get 1 2 n ( j )2 2 (j ) 1 V ej t K Ae j t n Therefore, T V A K (31) 2 1 2 n j 2 n (c) Since the natural frequency is 10,000 rad/s, let's plot from will notice that when n 102 to 106 rad/s. You 104 rad/s the real part of the denominator is zero and hence the phase of T is 90 . Also T is close to a maximum here. As gets much larger than n the terms in the denominator become large and T becomes very small. Hence, by plotting from 2 orders of magnitude below n to 2 orders of magnitude above should see all the interesting features of the frequency response diagram. Let's plot 5000 points of the frequency response function. To make the spaced on a log scale, we choose the i so that n , we values equally 5-25 log10 2 i 10 i i log10 (106 102 ) , i 4999 102 0, 1, 4999 (106 102 )(i / 4999) (32) In general, i min ( max min ) i /(N 1) In MATLAB a function logspace creates, the i 0, 1, N 1 (33) i for you. To create a vector, om, of 5000 2 6 frequency values, equally spaced on a logarithmic scale from 10 to 10 type: >>om=logspace(2,6,5000); Since we will be calculating T for different values of , and also because we will be using this form of the frequency response function many times, it would be a good idea to create a MATLAB function to calculate the frequency response given K, n , and the frequency vector om. We can then call this function from other m-files. To do this create an m-file of the same name as the function as shown below. %sndord.m function to calculate the value of a second order % system at values in the array om. % function [T] = sndord(K,omn,zeta,om); T=K./((1-(om/omn).^2)+j*(2*zeta*om/omn)); The function (m-file) has to be in a directory MATLAB can find, e.g. the directory you are working in. The MATLAB m-file to do the plotting will now look something like that shown below. % ch5fig6.m program to calculate a second order function % for different values of zeta. % Function: sndord.m is used % omn=10000; K=0.01; zeta=[ 0.7 0.1 0.001 ]; om=logspace(2,6,5000); t1=sndord(K,omn,zeta(1),om); t2=sndord(K,omn,zeta(2),om); t3=sndord(K,omn,zeta(3),om); subplot(211) semilogx(om,20*log10(abs(t1)),om,20*log10(abs(t2)),om,20*log1 0(abs(t3))); axis(([100 1000000 -120 20]) set(gca,'YTick',-120:20:20) grid 5-26 xlabel('Frequency - rad/s') ylabel('Mag (dB - V/(m/s^2))') subplot(212) semilogx(om,angle(t1)*180/pi,om,angle(t2)*180/pi,om,angle(t3) *180/pi); axis([100 1000000 -180 0]) set(gca,'YTick',-180:30:0) grid xlabel('Frequency - rad/s') ylabel('Phase - degrees') The result of running this m-file is shown in Figure 6. Notice that as decreases the peak in the magnitude plot becomes more pronounced and the majority of the 90 phase shift 0.7 the peak in the frequency response occurs over a shorter region of frequencies. At magnitude has nearly disappeared. Figure 6: Second order system frequency response for different values of damping ratio. (a) magnitude ref 1mV/ (m/s2 ) , (b) phase. Characteristics of a second order frequency response diagram 5-27 (a) Peak in the magnitude A peak will occur when the magnitude of the frequency response denominator in (31) is at a minimum. At this value of , the square of this quantity will also have a minimum. To find this minimum differentiate with respect to and set the result to zero. That is, differentiate 2 2 1 2 2 2 n n to get 2 2 1 2 n 2 n Setting this equal to zero and solving for 2 8 2 2 2 n gives (1 2 2 ) 2n This gives the resonant natural frequency 1 2 2 res n When 2 1/2 ( .7071) this becomes imaginary, and a peak no longer appears. If very small res approaches n . is (b) Phase change 2 tan 1 2 n 2 , if K 0 . When n the phase change is 90 or ( n ) /2 rads. This is often used as a method of finding the natural frequency of a second order system. The phase is As the phase tends to 180 or radians. (c) Roll-off in magnitude at high frequencies A decade is an increase in frequency by a factor of 10. When the transfer function is dominated by the 2 / 2n term, i.e. T( j ) and K2 4n 2 n 4 is large the magnitude of 5-28 10log10 T( j )2 A decade above this ( n 20log10 K 2n 40log10 n 20log10 K 2n 40log10 10 20log10 K 2n 40log10 40log10 10 20log10 K 2n 40log10 40 10 ) , 10log10 T( j10 ) 2 So at high frequencies the magnitude drops by 40 dB every time we increase the frequency by a factor of 10. We say that the roll-off is 40 dB/decade. Example for the Reader A first order system (RTD + bridge circuit) may be modeled by the differential equation shown below, dy dt y x(t) (a) What are the time constant ( ) and static sensitivity (K)? (b) Derive the frequency response function in terms of and K. (c) If the cut-off frequency ( c ) is defined as the point where the frequency response function magnitude drops 3 dB from its value at 0 , show that c 1/ . Prove that the phase of the frequency response function is 45 at the cut-off frequency. (d) Plot the frequency response function over a region that illustrates all its main features. .05 seconds and K 35mV/ C). (Choose (e) At high frequencies, prove that the roll-off is 20 dB/decade. Check on your plot that this is so. (f) What is the steady state response of this system to x(t) 5sin 2t 20sin 300t C? Calculating a useful operating frequency range We have noted earlier that to determine which signals we can measure accurately, we must determine the operating frequency range of a system. That is, where the frequency response function gain is constant and the phase is zero or a linear function of frequency. To simplify 5-29 matters, consider operating frequency regions where the phase is close to zero, i.e., systems without time delays. Signals we wish to measure must only have frequency content in the operating frequency range, if we wish to be able to measure the signals without distortion. Usually a system will not exhibit this desirable behavior exactly in any frequency region, and we must define an acceptable error in gain and phase that we are willing to accept. We then find at what frequencies this measurement system lies within these error bounds; this defines the operating frequency range. This is illustrated in Figure 7, where the measurement system is a second order system and in this example we are setting the acceptable error to be that the gain is flat within 1.0%. Note: though not shown here, there is a significant phase error in the region defined by this error bound on the gain. Figure 7: Acceptable error bounds on the frequency response of a second order system, used to define an operating frequency range 0.1, (b) 0.9 and (c) 0.66 (a) The "flat" part of the frequency response function of a second order system is approximately equal to K, the static sensitivity and the value of the frequency response function gain at zero 5-30 rad/s. We wish to find at which frequency the magnitude becomes 0.99 K or 1.01 K, whichever is the lower frequency. If the damping ratio is less than 0.7071 then the frequency response gain will peak and thus it is likely that by solving T( j ) 1.01 K we will find the upper limit of the operating frequency region. If the peak value of the frequency response function is less than 1.01 K or the damping ratio is larger than 0.7071, we will find the upper frequency limit by solving T( j ) 0.99 K . What is an acceptable error depends on the application and the cost of measurement errors. While 1% error in the gain was used here, it is by no means a standard definition of an acceptable error. Example A measurement system behaves as a first order system with a frequency response function: 20 1 j0.01 G( j ) The operating frequency range is defined as the frequency region where the gain error is less than 0.5% and the phase error is less than 1 . What is the operating frequency range? Solution A first order system frequency response gain drops from its value at low frequencies. To find the upper frequency limit as defined by the gain error, we solve: 202 1 (0.01 ) 2 (0.995 20)2 Note that we are using the square of the frequency response gain. Inverting both sides of this equation and multiplying by 400 gives: 1 0.0001 2 0.995 2 , giving a solution of: 100 0.995 2 1 10.04 rad/s. Now consider a phase error of 1 0.0175 radians. The phase of a first order system drops from 0 at DC (0 rad/s) to 90 at high frequencies. Hence, to find the upper frequency limit defined by this phase error, we solve: 0.01 0.0175 0 tan 1 1 This results in: 100 tan(0.0175) 1.75 rad/s 5-31 So the phase error limit restricts the operating frequency range much more than the gain error limit. The operating frequency range for this first order system, as defined by the error criteria specified, is 0 to 1.75 rad/s. PUTTING SYSTEMS TOGETHER T(t) G1 (jω) Thermocouple y1(t) G2 (jω) Amplifier y2(t) G3 (jω) Filter v(t) Figure 8: Block diagram of the measurement system Suppose we know the frequency response of each of the components: G1,G2 and G3. Can we say what the frequency response function of the entire system is? When we connect the components together the voltage we measure at the output of each system will drop. So, > y1 disconnected from amp disconnected from filter and connected to amp > y2 , y1 , y2 connected to filter This is caused by current flowing from the circuitry in one system to the next system. This is discussed more fully in Chapter 7. If the subsystems are designed properly we can reduce the voltage change so that the disconnected and connected voltages are approximately equal. If this is the case, then the output of the subsystem component, when disconnected, becomes the input to the next subsystem component, when it is connected. Consider the steady state response of the measurement system to e j t . Passing this input through the first component (thermocouple), the steady state response will be y1(t) G1 e j t . We will assume connection effects are negligible and this becomes the input to the second component. e j t input into the second component produces a steady state output G 2 e j t . From linear system theory, G1 e j t input into the second stage will produce a steady state output G1 times that produced by e j t , and so, y2 (t) G1 G2 e j t 5-32 Again we will assume that connection effects are negligible and this becomes the input to the third component (filter). e j t input to the filter produces a steady state output G 3 e j t . Therefore, G1 G2 e j t will produce a steady state output G1 G2 times this, i.e., v(t) G1G 2 G 3 e j t So we input e j t into the thermocouple, and G1 G2 G3 e j t is the steady state response of the measurement system, if we can ignore connection effects. The frequency response function of the entire system is therefore G( j ) G1( j ) G2 ( j ) G3( j ) , i.e. the product of the individual frequency response functions. Note also, therefore, G( j ) G1( j ) G 2 ( j ) G3( j ) and phase (G( j )) phase(G1( j )) phase(G2 ( j )) The steady state response of the entire system to T(t) v(t) AG A G1( j o ) G2 ( j o ) G3( j o ) sin o ot phase(G3( j )) Asin o is sin( ot phase(G) o ) phase(G1( j o )) phase(G 2 ( j o )) phase(G3 ( j o )) This approach to putting systems together can be applied to many problems, not only measurement system design. It is attractive to look at simpler subcomponents and then connect them together using this block diagram approach. However, caution must be exercised when doing this. The fundamental assumption, that there is no interaction between the systems when connected, may not be true. Below is an example of using this block diagram approach to an office noise problem. Example A printer in an office is making a noise that can be modeled by the sum of two sinewaves. p(t) 0.25 sin 1t 0.125 sin( 2t ) Pascal 720 rad/s and 2 1080 rad/s. This is measured with a microphone that has a constant frequency response function with a sensitivity of 50 mV/Pascal attached to an amplifier with a constant frequency response function = 100 V/V. (This is not true at very high frequencies, but is a sufficient model for this problem.) 1 John and Felicity share an office that is separated from the printer by a partition. The transmission path from the printer to John and Felicity's desks is approximately modeled by the frequency response function. 5-33 1 T( j ) 1 j / 800 Pascal/Pascal In addition, Felicity is wearing headphones with a frequency response function, H( j ) 0.9 (1 j / 600 Pascal/Pascal Calculate the steady state sound pressure that Felicity will sense from the printer. If you measured this with a microphone placed inside the headphones, what output voltage would you measure. Assume as you used the same microphone to make this measurement, as you used to measure the printer noise. Solution There are two systems here; (1) the sound pressure measurement and (2) the transmission path through the partition and the headphones. (1) p(t) (2) mic K=50mv/pascal v(t) Amp K=100V/V p1(t) v1(t) p(t) Transmission through partition T(jω) Headphone H(jω) p1(t) Figure 9: Block diagrams of two systems. (1) MIC plus amp, (2) transmission path plus headphones The first system is attached to the second to make the measurement of the sound at Felicity's ear. Assuming that no interaction effects occur between the systems when connected, the frequency response function relating p1(t) to p(t) is G1( j ) T( j )H( j ) 1 .9 1 j / 800 1 j / 600 Pascal/Pascal and the frequency response function relating p1(t) to v1(t) is G2 ( j ) T( j ) H( j ) 0.05 100 4.5 V/Pascal (1 j / 800) (1 j / 600) and G2 ( j ) 5 G1( j ) Since we are interested in the steady state response to sinewaves at 720 rad/s and 1080 rad/s, let's evaluate the frequency response function at these values. 0.9 G1( j720) , (1 j720 / 800) (1 j720 / 600) 5-34 0.9 G1( j720) (1 phase(G1( j720)) 1 0.9 ) 2 (1 1.22 ) 2 2 1 0.4283 , tan 1 0.9 tan 1 1.2 1.6089 rads Similarly, G1( j1080) G1( j1080) phase(G1( j1080)) 0.9 , (1 j1080 / 800) (1 j1080 / 600) .9 1 (1 1.35 ) 2 (1 1.82 ) 2 2 1 tan 1 1.35 tan 1 1.8 0.2602 , 1.9969 rads The steady state response of G1 to the input is therefore p1(t) 0.25 0.4283 sin (720t 1.6089) 0.125 0.2602 sin (1080t 9.9969) Pascal The measured signal will be 5p1(t) since the microphone plus amplifier's response is considered frequency independent in this example. So the measured voltage is v1(t) 0.5353 sin(720t 1.6089) 0.1626 sin(1080t 1.9969) Volts Note how the partition and headphones had a more significant effect on the 1080 rad/s component than they did on the 720 rad/s component. When solving these "wordy" problems, sketching out a block diagram of the system components and their connections will help you to sort out what is actually happening. Associated with each of the blocks should be enough information to write down or derive a frequency response function. Once you have connected the system and derived the overall frequency response function you know everything about the system. From this you can write down the differential equation of the system, or you can quickly calculate the steady state response to a sinusoidal excitation. 5-35 SUMMARY In this chapter we have reviewed basic complex variable relationships and the solution to linear ordinary differential equations. In particular, we have focused on steady state response (particular solution) to sinusoidal and step inputs, though we have derived transient (homogeneous) solutions as well. Building on the response to sinusoidal excitation we derived the frequency response function associated with a system by solving for the steady state response to e j t . This function is directly related to the differential equation model of the system and its magnitude and phase tell us how a particular frequency component is affected by the system, i.e. x(t) Asin ot, y(t) A T( j o ) sin ot phase(T( j o )) where x(t) is the input, y(t) the response and T( j ) the frequency response function. We also noted that, for measurement systems, the useful frequency operating range was the range where the gain of the frequency response function was flat and the phase was either zero or a linear function of frequency, the latter corresponding to the system introducing a time shift into the measurement. It is therefore very important to measure the frequency response function of the measurement system to determine the useful frequency range. At the end of the chapter we briefly looked at combining frequency response functions of components of measurement systems to generate an overall system frequency response function. If the components are well designed and voltages between subcomponents in the measurement system do not drop when connections are made, then the frequency response function of a measurement system, consisting of subsystems connected in series with frequency response functions: G1( j ),G2 ( j ),G3( j ),and G4 ( j ) , will be G( j ) G1( j ) G2 ( j ) G3( j ) G4 ( j ) This allows us to look at the simpler system components in isolation and model them separately. Then, by putting them together we can derive the more complicated frequency response function (model) of the whole system.