36 DISCRETE-SIGNAL ANALYSIS AND DESIGN to return to the time domain with the conÞdence that these two equations, especially in discrete sequences, do not require linearity or superposition. We will use this idea frequently in this book. A two-tone input signal of adjustable peak amplitude will be processed by a circuit that has a certain transfer characteristic which is similar to the Child-Langmuir equation [Seely, 1956, pp. 24 and 28, Eq. (2-14)] as derived in the early 1920s from Poisson’s equation for the electric Þeld in space-charge-limited diodes and also many common triode vacuum tubes: I out (n) ≈ KV g (n) 1.5 (2-3) The input (base-to-emitter or grid-to-cathode) two-tone signal at fre- quencies f 1 and f 2 is V g (n) = V s cos 2π n N f 1 + cos 2π n N f 2 + V dc (2-4) V s is the peak amplitude (1/2 of pk-to-pk) of each of the two input sig- nals. V dc is a bias voltage that determines the dc operating point for the particular device. This and a reasonable V s value are found from Hand- book V-I curves (the maximum peak-to-peak signal is four times V s ). The peak-to-peak ac signal should not drive the device into cutoff or saturation or into an excessively nonlinear region. Figure 2-5 is a typical approxi- mate spectrum for the two-tone output signal. The input frequencies are f 1 and f 2 , and the various intermodulation products are labeled. Adjusting V s and V dc for a constant value of peak desired per-tone output shows how distortion products vary. Note also the addition of 70 dB to the ver- tical axis. This brings up the levels of weak products so that they show prominently above the zero dB baseline (we are usually interested in the dB differences in the spectrum lines). Note also that the vertical scale for the spectrum values is the magnitude in dB because the actual values are in many cases complex, and we want the magnitude and not just the real part (we neglect for now the phase angles). Note that in this example we let Mathcad calculate V sig (n) 1.5 directly (the easy way), not by using discrete math (the hard way), just as we do with the exp(·), sin(·), cos(·) and the other functions. We are especially SINE, COSINE, AND θ 37 −10 −8 −6 −4 0 5 10 15 −12 20 0481216 40 60 80 100 k f 1 f 2 2f 2 −f 1 2f 1 −f 2 f 1 +f 2 2f 1 2f 2 f 2 −f 1 DC 2f 1 +f 2 2f 2 +f 1 3f 1 3f 2 Vsig(n) Vin(n)) Vdc dB N := 64 Vdc :=−8 Vout(n) := Vsig(n) 1.5 Vsig(n) := Vdc + 1.5⋅ n := 0, 1 63 k := 0, 1 63 Vin(n) := .25⋅n cos + cos2⋅p⋅⋅4 n N 2⋅p⋅⋅5 n N 1 N Fip(k) := ⋅ Vout(n)⋅exp −j⋅2⋅p⋅ n N ⋅k ∑ N−1 n = 0 Figure 2-5 Intermodulation measurements on an ampliÞer circuit. interested in discrete sequences and discrete ways to process them, but we also use Mathcad’s numerical abilities when it is sensible to do so. In embedded signal-processing circuitry, machine language subroutines do all of this “grunt” work. In this book we let Mathcad do it in an elegant fashion. 38 DISCRETE-SIGNAL ANALYSIS AND DESIGN 200 400 I out (n) 04812 15 16 20 24 28 32 5 10 15 20 25 30 35 40 0204060 n 80 100 120 k dB f 1 f 2 f 2 –f 1 DC 2f 1 2f 2 f 2 +f 1 1 N Fip (k) : = ⋅ I out (n) ⋅ exp −j ⋅ k ⋅2⋅π ⋅ n N Vg (n) := Vb ⋅ I out (n) := Vg (n) 2 + cos cos 2⋅π⋅ ⋅12 n N ⎛ ⎛ ⎛ ⎛ ⎛ ⎛ 2⋅π⋅ ⋅15 n N ⎛ ⎛ ⎛ ⎛ ⎛ ⎛ N := 128 n := 0,.01 N − 1 k := 0, 1 N − 1 Vb := 10 ∑ N−1 n = 0 Figure 2-6 Square-law ampliÞer, mixer, and frequency doubler. In Fig. 2-6 the exponent in Eq. (2-3) is changed from 1.5 to 2.0. This is the well-known square-law device that is widely used as a modulator (mixer) or frequency doubler [Terman, 1943, p. 565]. Note the absence of dc bias (optional). We see that frequencies f 1 and f 2 have disappeared from the output, the sum and difference of f 1 and f 2 are prominent and the second harmonics of f 1 and f 2 are strong also. Higher-order IMD products have also vanished. The nonlinearity in Eq. (2-3) can be customized for a wide variety of devices, based on their transfer characteristics, to explore ac circuit performance. For example, Eq. (2-3) can be in the form of an N -point Handbook lookup table for transistor or tube V–I curves. Pick 16 equally SINE, COSINE, AND θ 39 spaced values of V in (n) for n =0 to 15 and estimate as accurately as pos- sible the corresponding values of I out (n). Then get the positive frequency spectrum for low-order (2nd or 3rd) intermodulation products. Nonlinear circuit simulation programs such as Multisim can explore these problems in greater detail, using the correct dc and RCL components and accurate slightly nonlinear device models. Example 2-2: Analysis of the Ramp Function This chapter concludes with an analysis of the “ramp” function in Fig. 2-7a. It is shown in many references such as [Zwillinger, 1996, p. 49]. Its Fourier series equation in the Reference is f(x)= 1 2 − ∞ k=1 1 πk sin 2πxk L (2-5) where x is the distance along the x-axis. The term 1/2 is the average height of the ramp, and x always lies between 0 and +L. The sine-wave harmonics (k) extend from 1 to ∞, each with peak amplitude 1/πk .For each value of (k ), f (x) creates (k ) sine waves within the length L.The minus sign means that the sine waves are inverted with respect to the x axis. In Fig. 2-7 the discrete form of the ramp is shown very simply in part (a) as x(n) =n/N from 0 ≤n ≤N −1. We then apply the DFT (Eq. 1-2) to get the two-sided phasor spectrum X (k ) from 0 to N −1 in part (b). The following comments help to interpret part (b): • The real part has the value X (0) =0.5 at k =0, the dc value of the ramp. The actual value shown is 0.484, not 0.5, because the value 0.5 is approached only when the number of samples is very large. For N =2 9 =512, X (0) is 0.499. This is an example of the approxi- mations in discrete signal processing. For very accurate answers that we probably will never need, we could use 2 12 and the FFT. • The real part of X (k) from k =1toN −1 is negative, and part (c) shows that the sum of these real parts is −0.484, the negative of X (0). In part (c) the average of the real part from 0 to N −1 is zero, which is correct for a spectrum of sine waves with no dc bias. 40 DISCRETE-SIGNAL ANALYSIS AND DESIGN 051015202530 0 0.5 1 x(n) n 0 5 10 15 (c) (b) (a) 20 25 30 −0.2 0 0.2 0.4 + 0.484 k x(n) := n N N := 2 5 n := 0, 1 N − 1 k := 0, 1 N − 1 1 N X(k) : = ⋅ x(n)⋅exp −j⋅2⋅π⋅ n N ⋅k Re(X(k)) = −0.484 Im(X(k)) = 10 −15 Im(X(k)) 0 Re(X(k)) ∑ N−1 n = 0 ∑ N−1 k = 1 ∑ N−1 k = 1 Figure 2-7 Analysis of a ramp function. • The imaginary part of the plot is positive-going in the Þrst half, negative-going in the second half, and zero at N /2. Referring to Fig. 2-2, this arrangement of polarity agrees with the −sin diagram, as it should. • Applying the “Mathcad X-Y Trace” tool to the imaginary part of the spectrum plot in part (b), we Þnd that the two sides are odd-symmetric (Hermitian) about N /2. For this reason, the relative phase is zero for these sine waves (they all begin and end at zero phase). . (optional). We see that frequencies f 1 and f 2 have disappeared from the output, the sum and difference of f 1 and f 2 are prominent and the second harmonics of f 1 and f 2 are strong also. Higher-order. detail, using the correct dc and RCL components and accurate slightly nonlinear device models. Example 2-2: Analysis of the Ramp Function This chapter concludes with an analysis of the “ramp” function. do all of this “grunt” work. In this book we let Mathcad do it in an elegant fashion. 38 DISCRETE-SIGNAL ANALYSIS AND DESIGN 200 400 I out (n) 04812 15 16 20 24 28 32 5 10 15 20 25 30 35 40 0204060 n 80