ECEN 4652/5002 Communications Lab 04-13-15 Spring 2015 P. Mathys Lab 10: Real Bandpass and Complex Lowpass Signals, QAM, General BPFs 1 Introduction Modern communication systems are often implemented as a combination of digital and analog hardware. The digital part generally consists of a DSP (dgital signal processing) chip with associated software, and/or ASICs (application specific integrated circuit), FPGAs (fieldprogrammable gate arrays), etc. The analog part is usually used to frequency-shift, filter and amplify the transmitted and received signals at radio frequencies (RF). To interface beteeen the digital and analog parts, A/D (analog to digital) and D/A (digital to analog) converters are used. Digital hardware and associated software is able to produce and process signals with very precise specifications and reproducible characteristics. But because the processing speed in a digital system has to be at least twice the highest signal frequency, the carrier frequencies at which radio signals can be processed directly in the digital domain are limited, roughly to the MHz or at most the sub-GHz range. Analog hardware, on the other hand, can be built relatively easily up into the GHz region. But once built, it cannot just be reprogrammed for another application. Also, component tolerances and component aging limit the precision of analog signal shaping that can be achieved economically. The best design philosophy to adopt is therefore to perform all precise and complicated signal processing functions at the lower frequencies which DSP hardware can handle directly, and to use the analog hardware only for amplification of low level signals, simple filtering, and frequency conversion to and from the high RF frequencies. The mathematical tool that enables this approach is the frequency shift property of the Fourier transform, which allows real-valued bandpass signals to be converted to complex-valued lowpass signals and vice versa. 1.1 Complex Lowpass Representation of Real Bandpass Signals A real-valued bandpass (RBP) signal with center frequency fc and bandwidth 2fL is a signal x(t) whose Fourier transform (FT) X(f ) satisfies X(f ) = X ∗ (−f ) , and |X(f )| = 0 , for 0 ≤ |f | < fc −fL and |f | > fc +fL . An example of the FT of a RBP signal is shown in the graph below. 1 X(f ) A −fc +fL −fc −fL −fc fc −fL fc fc +fL f −A Since X(f ) = X ∗ (−f ), it suffices to know X(f ) for f > 0. Shifted left by fc and multiplied by 2, this yields XL (f ) ⇔ xL (t) as shown below for the example X(f ). XL (f ) 2A −fL f fL −2A The signal xL (t), which is complex-valued in general, is called a complex-valued lowpass (CLP) signal and xL (t) is the CLP representation of the RBP signal x(t). Note that if x(t) has bandwidth 2fL , then xL (t) has bandwidth fL . To recover x(t) from xL (t) use x(t) = Re{xL (t) e j2πfc t xL (t) ej2πfc t + x∗L (t) e−j2πfc t . }= 2 Using the FT pairs xL (t) ej2πfc t ⇐⇒ XL (f −fc ) , x∗L (t) e−j2πfc t and ⇐⇒ XL∗ (−f −fc ) , this corresponds to XL (f −fc ) + XL∗ (−f −fc ) X(f ) = 2 =⇒ X(f ) = X ∗ (−f ) , in the frequency domain. Since xL (t) is complex-valued, it can be written as xL (t) = Re{xL (t)} + j Im{xL (t)} = xLi (t) + j xLq (t) , where xLi (t) is the in-phase component (or real part) of xL (t) and xLq (t) is the quadrature component (or imaginary part) of xL (t). From xL (t) ⇔ XL (f ) and x∗L (t) ⇔ XL∗ (−f ), the FTs of xLi (t) and xLq (t) are obtained as follows: xL (t) + x∗L (t) 2 xL (t) − x∗L (t) xLq (t) = Im{xL (t)} = 2j ⇐⇒ xLi (t) = Re{xL (t)} = ⇐⇒ 2 XL (f ) + XL∗ (−f ) , 2 XL (f ) − XL∗ (−f ) XLq (f ) = . 2j XLi (f ) = Therefore XL (f ) = XLi (f ) + j XLq (f ) . But note that, while xLi (t) and xLq (t) are real-valued, their FTs XLi (f ) and XLq (f ) are complex-valued in general. The following figure shows XLi (f ) and XLq (f ) for the example of X(f ) that was given earlier. XLq (f ) XLi (f ) 2jA jA 2A A −fL f fL 0 fL f −fL −jA −2jA The blockdiagram given below shows how to convert the RBP signal x(t) to its CLP representation xL (t) and how to reconstruct x(t) from xL (t). x(t) v(t) × LPF at fL xL (t) xL (t) 2e−j2πfc t × w(t) Re{.} x(t) ej2πfc t Note that, except for x(t), all signals are complex-valued. An implementation of the conversion from x(t) to xL (t) = xLi (t) + j xLq (t), and vice versa, that uses only real-valued signals is shown in the next blockdiagram. × x(t) vi (t) LPF at fL xLi (t) xLi (t) × + • 2 cos 2πfc t + cos 2πfc t x(t) + × vq (t) LPF at fL xLq (t) −2 sin 2πfc t | {z } AM Demodulators xLq (t) × − sin 2πfc t | {z } AM Modulators The insight gained from this version is that conversion from x(t) to xL (t) is equivalent to AM demodulation with both a cosine and a (negative) sine carrier, whereas reconstruction of x(t) from xL (t) is equivalent to AM modulation, again with the same carriers. 3 Hilbert Transform. Yet another method to obtain the CLP representation xL (t) of the RBP signal x(t) makes use of the Hilbert transform xh (t) of x(t), which is defined as xh (t) = H{x(t)} = 1 ∗ x(t) πt ⇐⇒ Xh (f ) = −j sgn(f ) X(f ) . Combining x(t) and jxh (t) yields the Fourier transform pair xu (t) = x(t) + j xh (t) Xu (f ) = 1 + sgn(f ) X(f ) = 2u(f ) X(f ) , ⇐⇒ where Xu (f ) = 2X(f ) , f > 0 , 0, otherwise . Thus, xL (t) is obtained by shifting Xu (f ) left by fc , as shown in the following blockdiagram. x(t) + • + H{ . } 1.2 xh (t) xu (t) + j × xL (t) e−j2πfc t Quadrature Amplitude Modulation A regular AM-DSB-SC signal with carrier frequency fc has the form x(t) = m(t) cos(2πfc t) , where m(t) is the message signal, e.g., speech, music, or a PAM signal. But nothing speaks against using a sine carrier instead of a cosine carrier, and x0 (t) = −m(t) sin(2πfc t) , where the minus sign was used for consistency in notation but has no other fundamental meaning, is just as good an AM-DSB-SC signal as x(t). In fact, because sin(2πfc t) and cos(2πfc t) are orthogonal functions, x(t) and x0 (t) can be used simultaneously to generate a quadrature amplitude modulated (QAM) signal of the form x(t) = mi (t) cos(2πfc t) − mq (t) sin(2πfc t) , where mi (t) is the in-phase message signal and mq (t) is the quadrature message signal. The block diagrams of a QAM modulator and a QAM demodulator are shown below. 4 mi (t) × cos 2πfc t mq (t) × + x(t) r(t) • vi (t) LPF at fL m ˆ i (t) LPF at fL m ˆ q (t) 2 cos 2πfc t vq (t) × × − sin 2πfc t −2 sin 2πfc t Setting r(t) = x(t), the demodulator computes vi (t) = 2x(t) cos 2πfc t = 2mi (t) cos2 2πfc t − 2mq (t) sin 2πfc t cos 2πfc t = mi (t) (1 + cos 4πfc t) − mq (t) sin 4πfc t , vq (t) = −2x(t) sin 2πfc t = −2mi (t) cos 2πfc t sin 2πfc t + 2mq (t) sin2 2πfc t = −mi (t) sin 4πfc t + mq (t) (1 − cos 4πfc t) . Thus, after lowpass filtering at fL = fm , where fm ≤ fc is the highest message frequency, the in-phase and quadrature message signals mi (t) and mq (t) can be recovered independently of each other. Practical transmission systems rarely use QAM to directly transmit and receive two independent analog message signals mi (t) and mq (t). The main reason is the difficulty to establish and maintain exact frequency and phase synchronization between transmitter and receiver. However, since any real bandpass signal x(t) can be regarded as a QAM signal with mi (t) = xLi (t) and mq (t) = xLq (t), where xL (t) = xLi (t) + j xLq (t) is the CLP representation of x(t), QAM can be used to generate (and demodulate) any AM, PM, or FM signal. Characteristic examples are given below. AM-DSB. For AM-DSB-SC with message signal m(t), carrier frequency fc , and carrier phase θc , the transmitted real-valued bandpass signal is x(t) = m(t) cos(2πfc t + θc ) = m(t) cos θc cos 2πfc t − m(t) sin θc sin 2πfc t . | {z } | {z } = mi (t) = mq (t) The corresponding complex-valued lowpass signal is thus xL (t) = mi (t) + j mq (t) = m(t) (cos θc + j sin θc ) . For AM-DSB-TC, simply replace m(t) by 1 + α mn (t). PM/FM. For phase modulation with normalized message signal mn (t), maximum phase deviation ∆θ , and carrier frequency fc , the transmitted real-valued bandpass signal is x(t) = cos 2πfc t + ∆θ mn (t) = cos(∆θ mn (t)) cos 2πfc t − sin(∆θ mn (t)) sin 2πfc t . {z } | {z } | = mi (t) = mq (t) 5 The complex-valued lowpass signal corresponding to x(t) is therefore xL (t) = mi (t) + j mq (t) = cos(∆θ mn (t)) + j sin(∆θ mn (t)) . For frequency modulation with maximum frequency deviation ∆f , mi (t) and mq (t) become Z t Z t mi (t) = cos 2π∆f mn (τ ) dτ , and mq (t) = sin 2π∆f mn (τ ) dτ , −∞ and thus −∞ xL (t) = cos 2π∆f Z t mn (τ ) dτ + j sin 2π∆f −∞ 1.3 Z t −∞ mn (τ ) dτ . General Bandpass Filters Let h(t) be the unit impulse response of a real-valued bandpass filter (BPF) with real-valued input x(t) and real-valued output y(t) so that y(t) = x(t) ∗ h(t) . Define the following complex-valued lowpass representations y(t): yL (t) = yLi (t) + j yLq (t) , x(t): xL (t) = xLi (t) + j xLq (t) , h(t): hL (t) = hLi (t) + j hLq (t) . In complex-valued lowpass form the operation of the BPF can be described as yL (t) = xL (t) ∗ hL (t) = [xLi (t) + j xLq (t)] ∗ [hLi (t) + j hLq (t)] = [xLi (t) ∗ hLi (t) − xLq (t) ∗ hLq (t)] +j [xLi (t) ∗ hLq (t) + xLq (t) ∗ hLi (t)] . {z } | {z } | = yLi (t) = yLq (t) A block diagram which implements this convolution and includes the translation from passband (around fc ) to baseband and vice versa is shown in the figure below. × xLi (t) • + yLi(t) − hLq (t) 2 cos 2πfc t x(t) + hLi (t) × cos 2πfc t + • + + hLq (t) × xLq (t) + • hLi (t) + −2 sin 2πfc t + yLq (t) × − sin 2πfc t 6 y(t) To determine hLi (t) ⇔ HLi (f ) and hLq (t) ⇔ HLq (f ) from h(t) ⇔ H(f ), proceed as follows. Shift H(f ) to the left using some conveniently chosen fc . Then lowpass filter the result with an appropriate cutoff frequency fL and multiply the result by 2. This yields the CLP representation HL (f ) ⇔ hL (t). Then use HLi (f ) = HL (f ) + HL∗ (−f ) , 2 and HLq (f ) = HL (f ) − HL∗ (−f ) , 2j to obtain the desired in-phase and quadrature components needed to implement the filter with real-valued hardware and/or software. Example: VSB/SSB Filter. To convert AM-DSB signals into AM-VSB-USB or AMSSB-USB signals, a BPF with the following ideal real-valued FT specification h(t) ⇔ H(f ) can be used. H(f ) 0 ≤ ∆ ≤ fL 1 −fc −fL −fc −fc −∆ −fc +∆ fc 0 fc −∆ fc +fL f fc +∆ After shifting this spectrum to the left by fc , multiplying it by 2, and lowpass filtering it at fL , the following spectrum HL (f ) of the complex-valued lowpass representation hL (t) of the BPF is obtained. HL (f ) 0 ≤ ∆ ≤ fL 2 −fL −∆ 0 ∆ fL f Making use of hL (t) + h∗L (t) 2 hL (t) − h∗L (t) hLq (t) = 2j hLi (t) = ⇐⇒ ⇐⇒ HL (f ) + HL∗ (−f ) 2 HL (f ) − HL∗ (−f ) H ∗ (−f ) − HL (f ) HLq (f ) = =j L 2j 2 HLi (f ) = yields the in-phase and quadrature component spectra of hL (t) shown in the next two graphs. HLi (f ) 0 ≤ ∆ ≤ fL 1 −fL −∆ 0 ∆ 7 fL f HLq (f ) 0 ≤ ∆ ≤ fL j ∆ −fL fL f −∆ −j A convenient way to implement the BPF considered in this example is shown in the following blockdiagram. × h1 (t) • × + − h2 (t) 2 cos 2πfc t x(t) + xLi (t) cos 2πfc t + • y(t) + + h2 (t) × h1 (t) • + xLq (t) + × + −2 sin 2πfc t − sin 2πfc t In this blockdiagram hLi (t) = h1 (t) and hLq (t) = h1 (t) ∗ h2 (t), with h1 (t) and h2 (t) as given next. H1 (f ) h1 (t) = sin(2πfL t) πt 1 ⇐⇒ −fL f fL 0 H2 (f ) h2 (t) = 1 sin(2π∆t) πt 2π∆t ··· ⇐⇒ j ∆ −fL −∆ −j fL f ··· Now, if the filter input x(t) is an AM-DSB signal with carrier frequency fc ≥ fL , i.e., x(t) = m(t) cos(2πfc t), then xLq (t) = 0 and therefore the block diagram of a AM-VSB-USB or AM-SSB-USB modulator can be reduced to the following. 8 m(t) mL (t) • h1 (t) × + + cos 2πfc t y(t) + × h2 (t) − sin 2πfc t The benefits of using this blockdiagram for implementing AM-VSB and AM-SSB modulation are that all filtering is done at baseband and can be implemented very precisely and maintenance-free using DSP chips, even if fc is several hundred MHz or a few GHz, as would be the case for cellular telephones or wireless LANs. Off the shelf analog ICs exist for the implementation of the QAM modulator stage for such applications. 1.4 Filterless SSB Upconversion Modern communication systems generally use digital signal processing (DSP) to generate signals that satisfy precise specifications, largely independent of component tolerances and component aging. However, power, price, and availability considerations often necessitate the use of a lower carrier frequency fc1 at the output of the DSP than the final carrier frequency fc2 . Typical values are fc1 ≈ 1 . . . 20 MHz and fc2 ≈ 1 . . . 5 GHz. One solution to convert a signal x(t) with carrier frequency fc1 at the ouput of a DSP system to an actually transmitted signal y(t) with carrier frequency fc2 , is to use a mixer as shown below in the form of a blockdiagram. x(t) at fc1 × v(t) BPF y(t) at fc2 2 cos 2π(fc2 −fc1 )t Because 2 cos 2πfc1 t cos 2π(fc2 − fc1 )t = cos 2π(fc2 − 2fc1 )t + cos 2πfc2 t , a BPF is necessary to reject the signal at frequency fc2 − 2fc1 . If fc2 = 2 GHz and fc1 = 2 MHz, then the (analog) BPF needs to have a very narrow band, with a width of only about 2 MHz at 2 GHz, for the transition from passband to stopband. To avoid the need for such a BPF, the strategy outlined in the following blockdiagram can be used. 9 x(t) at fc1 + • + H{ . } xh (t) xu (t) + × w(t) Re{ . } y(t) at fc2 j ej2π(fc2 −fc1 )t The Hilbert transform block computes xh (t) = H{x(t)} = 1 ∗ x(t) πt ⇐⇒ Xh (f ) = −j sgn(f ) X(f ) , and thus xu (t) = x(t) + j xh (t) ⇐⇒ Xu (f ) = 1 + sgn(f ) X(f ) = 2u(f ) X(f ) . That is, the complex-valued signal xu (t) has a spectrum that is zero for all f < 0. The multiplication with ej2π(fc2 −fc1 )t then frequency-shifts that spectrum right by fc2 − fc1 . Finally, after taking the real part of the result, a real bandpass signal y(t) at fc2 is obtained, without the additional signal at fc2 − 2fc1 . An implementation of this, using only real-valued signals and processing blocks, is shown in the blockdiagram below. × x(t) at fc1 + • 2 cos 2π(fc2−fc1 )t H{ . } xh (t) + + y(t) at fc2 × −2 sin 2π(fc2 −fc1 )t Implementing the Hilbert transform in analog hardware is quite non-trivial, but in a DSP chip it is fairly simple and straightforward. The QAM modulation with carrier frequency fc2 − fc1 is usually done with analog hardware. To suppress signal components at fc2 − 2fc1 , it is crucial to maintain the 90◦ phase shift between the oscillators precisely, and to have all other characteristics between the in-phase and quadrature paths closely matched. 1.5 Zero IF Receivers If digital signal processing is used at a receiver for AM, QAM, PM , or FM signals, then it is generally more efficient to work with complex lowpass signals than with real-valued bandpass signals at some intermediate frequency fIF , because in this way the sampling rate can be kept at a minimum. Thus, rather than using a conventional superheterodyne front 10 end and a IF amplifier, modern communications receivers very often use a “zero IF” design, whereby the received signal is directly mixed down to baseband. However, in order to keep all processing options, such as extracting a carrier term for synchronization, or equalization for crosstalk between in-phase and quadrature signal components, open, both a sine and a cosine oscillator are used for the mixer. This corresponds to multiplying the received (real) signal r(t) by the complex exponential e−j2πfc t , which just simply shifts the spectrum R(f ) to the left by fc . The general structure of a zero IF receiver is shown in the following block diagram. vi (t) × • hLi (t) hLq (t) 2 cos 2πfc t r(t) • hLq (t) vq (t) × • hLi (t) y1 (t) y2 (t) y3 (t) y4 (t) −2 sin 2πfc t Most of the processing at the receiver is done by selecting the right filters hLi (t) and hLq (t), and then by taking linear combinations of their outputs y1 (t) . . . y4 (t). Both local oscillators are needed in most cases (including AM-DSB-SC), but not all four filters are needed in all cases. Example: AM-SSB-USB Zero IF Receiver. The blockdiagram below shows the operation of a zero IF receiver for AM-SSB-USB using complex-valued signal paths and complexvalued signal processing. r(t) × v(t) m ˆ u (t) HL (f ) Re{.} m(t) ˆ HL (f ) for USB 2e−j2πfc t 1 f −fm 0 fm The (real-valued) signal r(t) is shifted left by fc in the frequency domain by multiplication with 2e−j2πfc t . The resulting (complex-valued) signal v(t) is then lowpass filtered and, using the specific HL (f ) shown above, only the upper sideband is present in the (complex-valued) message signal m ˆ u (t). Taking the real part of this signal yields the (real-valued) received 11 message signal m(t). ˆ The next blockdiagram shows an implementation that uses only realvalued signal paths and real-valued processing blocks. × vi (t) • hLi (t) hLq (t) 2 cos 2πfc t r(t) • hLq (t) × vq (t) • hLi (t) + y1 (t) + m(t) ˆ − y2 (t) wired for SSB-USB y3 (t) y4 (t) −2 sin 2πfc t Finally, the Fourier transforms of the filters with (real-valued) impulse responses hLi (t) and hLq (t) are shown in the following two graphs. HLq (f ) HLi (f ) 1/2 −fm 2 j/2 0 fm f −fm fm f −j/2 Lab Experiments E1. QAM Modulation/Demodulation. (a) Implement the Matlab function qamxmtr for QAM modulation whose header is shown below. 12 function xt = qamxmtr(tt,mi,mq,fcparms,fmparms) %qamxmtr Qadrature Amplitude Modulation (QAM) Transmitter % >>>>> xt = qamxmtr(tt,mi,mq,fcparms,fmparms) <<<<< % where % xt: transmitted QAM signal % tt: time axis for mi(t), mq(t), x(t) % mi: (wideband) in-phase message signal to be modulated % mq: (wideband) quadrature message signal to be modulated % fcparms = [fc thetaei thetaeq] % fc: carrier frequency % thetaei: carrier phase error, in-phase (cos) oscillator % thetaeq: carrier phase error, quadrature (sin) oscillator % fmparms = [fm km alpham] LPF at fm parameters % no LPF at fm if fmparms = [] % fm: highest message frequency % km: LPF h(t) truncation to -km/2fm <= t <= km/2fm % alpham: LPF at fm frequency rolloff parameter, linear % rolloff over range 2*alpham*fm Test the qamxmtr function by generating x(t) from mi (t) = cos(2πfmi t), fmi = 1000 Hz, and mq (t) = cos(2πfmq t), fmq = 2000 Hz. Use Fs = 44100 Hz and fc = 4000 Hz and generate a signal of length ≈ 1 sec. Set the phase errors θei and θeq to zero. Use showft to display the Fourier transform of x(t). What happens if you leave mi (t) unchanged, but use mq (t) = sin(2πfmq t), fmq = 1000 Hz. Save the two QAM signals as myqam901.wav and myqam902.wav. (b) Implement the Matlab function qamrcvr for QAM demodulation whose header is shown below. 13 function [mihat,mqhat] = qamrcvr(tt,rt,fcparms,fmparms) %qamrcvr Quadrature Amplitude Modulation (QAM) Receiver % >>>>> [mihat,mqhat] = qamrcvr(tt,rt,fcparms,fmparms) <<<<< % where % mihat: demodulated in-phase message signal % mqhat: demodulated quadrature message signal % tt: time axis for r(t), mihat(t), mqhat(t) % rt: received QAM signal % fcparms = [fc thetaei thetaeq] % fc: carrier frequency % thetaei: in-phase (cos) local osc phase error % thetaeq: quadrature (sin) local osc phase error % fmparms = [fm km alpham] % no LPF at fm if fmparms = [] % fm: highest message frequency % km: LPF h(t) truncation to -km/2fm <= t <= km/2fm % alpham: LPF at fm frequency rolloff parameter, linear % rolloff over range 2*alpham*fm Use the QAM signals from part (a) to verify that the QAM demodulator works correctly. (c) Use the speech signal in speech1001.wav and the music signal in music1001.wav as inphase and quadrature message signals to generate a QAM signal x(t) with fc = 6000 Hz and fm = 4000 Hz. Set the phase errors θei and θeq to zero. Save this signal as myqam1003.wav for later use. Then use the showpsd function to verify that the QAM signal indeed only occupies a bandwidth of about 8 kHz Next, use qamrcvr with the same fc = 6000 Hz and θei = θeq = 0 to verify that mi (t) and mq (t) can be recovered independently and without interference from each other. Thus, as opposed to AM-DSB, no bandwidth expansion takes place when QAM is used. But how robust is QAM with respect to phase and frequency errors between transmitter and receiver? Test this by generating another QAM signal with the same parameters as above, except for setting the phase error θeq = 10◦ , so that the sine and cosine carriers are now offset by 100◦ rather than 90◦ . Demodulate using the same phase error and check whether mi (t) and mq (t) can still be recovered without interference from each other. (d) Real-world bandpass channels are often asymmetric around the center or carrier frequency fc . How does that affect QAM signals? Use the trapfilt function to generate a filter with the frequency response shown below. 14 FT Approximation , F =44100 Hz, N=44100, ∆ =1 Hz s f 1.4 1.2 |X(f)| 1 0.8 0.6 0.4 0.2 0 0 2000 4000 6000 f [Hz] 8000 10000 12000 Then pass the QAM signal in myqam903.wav through the filter with the above frequency response and demodulate the received signal. Listen to mi (t) and mq (t) and describe the effect that the asymmetric filter has on each. (e) Show how to construct a (real-valued) BPF with frequency response as shown below (passband from 6 to 14 kHz, gain of 1 at 6 kHz and gain of 2 at 14 kHz, linear phase in passband) using a complex-valued LPF implementation. FT Approximation , Fs=44100 Hz, N=44100, ∆f=1 Hz 2.5 |X(f)| 2 1.5 1 0.5 0 −2.5 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 2.5 4 x 10 200 ∠X(f) [deg] 100 0 −100 −200 −2.5 −2 −1.5 −1 −0.5 0 f [Hz] 0.5 1 1.5 2 2.5 4 x 10 In particular, determine the frequency responses HLi (f ) ⇔ hLi (t) and HLq (f ) ⇔ hLq (t). (f ) Implement the BPF with the frequency response shown in (e) in the GNU Radio Companion. Use a speech or music signal to generate a AM-DSB-SC signal with fc = 10 kHz 15 and pass it through the BPF. Demodulate the output using two coherent demodulators, one using cos(2πfc t) and another one using sin(2πfc t) for the local oscillator. Listen to both outputs. Should you hear the speech/music signal from both demodulators or only from one of them? Explain! E2. AM-VSB/SSB Generation with Baseband Filters. (a) The unit impulse response and the frequency response of an ideal CT Hilbert transform filter are given by h(t) = 1 πt ⇐⇒ H(f ) = −j sgn(f ) . That is, the Hilbert transform leaves the magnitude of the input signal unchanged, but shifts the phase by −90◦ . Use the following Matlab code to generate h(t), sampled at rate Fs , and to look at its FT. Fs = 44100; tt = [0:Fs-1]/Fs-1/2; ht = zeros(size(tt)); ix = find(tt~=0); ht(ix) = 1./(pi*tt(ix)); showft(tt,ht,[-Fs/2 Fs/2 0]) %Sampling rate %Time axis %Unit impulse response You should find that the phase shift by −90◦ works well, but the magnitude of H(f ) is not equal to 1 for all f . However, changing h(t) to the following h0 (t) h0 (t) = cos πFs t 1 − , πt πt and using the Matlab code Fs = 44100; %Sampling rate tt = [0:Fs-1]/Fs-1/2; %Time axis ht = zeros(size(tt)); %Unit impulse response ix = find(t~=0); ht(ix) = 1./(pi*tt(ix)); ht(ix) = h(ix)-cos(pi*Fs*tt(ix))./(pi*tt(ix)); showft(tt,ht,[-Fs/2 Fs/2 0]) works very well. Can you explain why? Hint: Remember that Matlab (and DSP chips in general) can only work with DT signals that are derived from their CT counterparts by sampling at rate Fs (without violating the sampling theorem). (b) The Matlab function hilbfilt, whose header is given below, is used to implement the filter with impulse response 1 sin 2π∆t h2 (t) = , πt 2π∆t 16 which was derived in the introduction. When ∆ = 0, the filter computes the Hilbert transform of the input signal x(t). Using the results from part (a), use the following h02 (t) = 1 sin 2π∆t cos πFs t − , πt 2π∆t πt instead of the original h2 (t) to complete hilbfilt. function yt = hilbfilt(xt,Fs,ord,delta) %hilbfilt Delay Compensated FIR Hilbert Transform Filter % (-90 deg Phase Shift) % >>>>> yt = hilbfilt(xt,Fs,ord,delta) <<<<< % where % yt: filter output y(t), sampling rate Fs % xt: filter input x(t), sampling rate Fs % Fs: sampling rate for x(t), y(t) % ord: filter order (must be even) % delta: linear transition region -delta<f<delta % % ^ H(f) % | % +--------------- + j +-- - % | \ | | % -Fs/2| \| delta | % ------+--------------+--+--+--------------+-------> f % | -delta |\ |Fs/2 % | | \ | % - - --+ -j + ---------------+ % | To test hilbfilt, use Fs = 44100; %Sampling rate ord = 300; %Filter order delta = 1000; %Transition band parameter tt = [0:Fs-1]/Fs-1/2; %Time axis ui = zeros(size(tt)); ui(1+Fs/2) = Fs; %Unit impulse at t=0; h2 = hilbfilt(ui,Fs,ord,delta); %Impulse response h(t) showft(tt,h2,[-5000 5000 0]) This should result in the following graphs for the magnitude (linear scale!) and the phase of the frequency response of the Hilbert filter. 17 FT Approximation , Fs=44100 Hz, N=44100, ∆f=1 Hz 1.4 1.2 |X(f)| 1 0.8 0.6 0.4 0.2 0 −5000 −4000 −3000 −2000 −1000 0 1000 2000 3000 4000 5000 −4000 −3000 −2000 −1000 0 f [Hz] 1000 2000 3000 4000 5000 200 ∠X(f) [deg] 100 0 −100 −200 −5000 (c) Use the filter functions trapfilt and hilbfilt to implement the AM transmitter function amxmtr30 whose description is shown below. It uses the idea of complex lowpass filtering to generate AM-VSB and AM-SSB signals with selectable LSB or USB and selectable transition region −∆ . . . ∆, 0 ≤ ∆ ≤ fm , for AM-VSB. 18 function xt = amxmtr30(tt,mt,xtype,fcparms,fmparms,hLparms) %amxmtr30 Amplitude Modulation Transmitter, V3.0 % Uses complex lowpass shaping with hL(t)=hLi(t)+j*hLq(t) % for AM-VSB/SSB filtering % >>>>> xt = amxmtr30(tt,mt,xtype,fcparms,fmparms,hLparms) <<<<< % where % xt: transmitted AM signal % tt: time axis for m(t), x(t) % mt: (wideband) message signal to be modulated % xtype: amplitude modulation transmitter type from list % {’amdsbsc’,’amdsbtc’,’amssbsc’,’amvsbsc’} % fcparms = [fc thetac] for {’amdsbsc’,’amssbsc’,’amvsbsc’} % fcparms = [fc thetac alpha] for {’amdsbtc’} % fc: carrier frequency % thetac: carrier phase in deg (0: cos, -90: sin) % alpha: modulation index 0<=alpha<=1 % fmparms = [fm km alpham] LPF at fm parameters % no LPF at fm if fmparms = [] % fm: highest message frequency % km: LPF h(t) truncation to -km/2fm <= t <= km/2fm % alpham: LPF at fm frequency rolloff parameter, linear % rolloff over range 2*alpham*fm % hLparms = [sb ordL delta] for {’amssbsc’,’amvsbsc’} % (use small delta for ’amssbsc’) % sb: sideband (sb=-1 LSB, sb=+1 USB) % ordL: order of hL filter (ordL = length(hL)-1) % delta: frequency rolloff fc-delta to fc+delta Test amxmtr30 by generating a AM-VSB-USB-SC, a AM-VSB-LSB-SC, a AM-SSB-USB-SC, and a AM-SSB-LSB-SC signal with fc = 6000 Hz and Fs = 44100 Hz from the (increasing) chirp signal in chirp1001.wav. Assume fm = 3000, use ∆ = 1000 Hz and ordL ≈ 200 for the AM-VSB signals, and ∆ = 50 Hz and ordL ≈ 1000 for the AM-SSB signals. Use showpsd to check the spectrum of each of the four signals for correctness. (d) Use amxmtr30 and the signals in chirp1001.wav (chirp with increasing frequency) and chirp1002.wav (chirp with decreasing frequency) to generate a AM-SSB-USB-SC and a AM-SSB-LSB-SC signal, respectively, with Fs = 44100 Hz at fc = 6000 Hz. Add the two signals to obtain a AM-DSB-SC signal whose upper and lower sidebands carry different message signals. Save this signal as myam1004.wav for later use. (e) Use the idea of filterless SSB upconversion to shift the QAM signal that you saved in myqam1003.wav from a carrier frequency of fc1 = 6000 Hz to a carrier frequency of fc2 = 7000 Hz. Verify the integrity of this signal by demodulating it using qamrcvr. How does this operation of shifting the spectrum of a QAM signal (or any real bandpass signal) differ from using a mixer that would multiply the QAM signal with a local oscillator at frequency fx = fc2 − fc1 ? 19 E3. Zero IF Receiver. (Experiment for ECEN 5002, optional for ECEN 4652) (a) Use the following blockdiagram as a basis for an AM receiver that can be used to receive AM-DSB, and AM-SSB signals, with a provision to select either the LSB or the USB. × vi (t) • hLq (t) 2 cos 2πfc t r(t) hLi (t) • hLq (t) × vq (t) • hLi (t) y1 (t) y2 (t) y3 (t) y4 (t) −2 sin 2πfc t To demodulate an AM-DSB-SC signal, the output y1 (t) can be used directly. To demodulate AM-SSB-SC signals, a linear combination (either sum or difference) of y1 (t) and y3 (t) is used. The header of this zero-IF AM receiver with complex lowpass filtering, called amrcvr30, looks as follows 20 function mhat = amrcvr30(tt,rt,rtype,fcparms,fmparms,hLparms) %amrcvr30 Amplitude Modulation Receiver, V3.0 % Zero-IF receiver with complex lowpass filtering % using hL(t)=hLi(t)+j*hLq(t) % >>>>> mhat = amrcvr30(tt,rt,rtype,fcparms,fmparms,hLparms) <<<<< % where % mhat: demodulated message signal % tt: time axis for r(t), mhat(t) % rt: received AM signal % rtype: amplitude modulation receiver type from list % {’amdsbsc’,’amssbsc’,’amvsbsc’} % fcparms = [fc thetac] for {’amdsbsc’,’amssbsc’,’amvsbsc’} % fc: carrier frequency % thetac: carrier phase in deg (0: cos, -90: sin) % fmparms = [fm km alpham] LPF at fm parameters % no LPF at fm if fmparms = [] % fm: highest message frequency % km: LPF h(t) truncation to -km/2fm <= t <= km/2fm % alpham: LPF at fm frequency rolloff parameter, linear % rolloff over range 2*alpham*fm % hLparms = [sb ordL delta] for {’amssbsc’,’amvsbsc’} % (use small delta for ’amssbsc’) % sb: sideband (sb=-1 LSB, sb=+1 USB) % ordL: order of hL filter (ordL = length(hL)-1) % delta: frequency rolloff fc-delta to fc+delta Test the receiver using the signal you saved earlier in myam1004.wav (AM signal with different chirp signals in the LSB and USB). (b) Analyze the signals in the wav-files amsig1002.wav and amsig1003.wav. The first signal is an AM-DSB-SC signal with one of the sidebands jammed. The second signal consists of a set of frequency division multiplexed AM-SSB-SC signals with carrier frequencies fc1 = 2000 Hz, fc2 = 5500 Hz, fc3 = 9000 Hz, fc4 = 12500 Hz, and fc5 = 16000 Hz. Demodulate all message signals with as little noise and crossinterference as possible, using amrcvr30 c 2000–2015, P. Mathys. Last revised: 4-20-15, PM. 21
© Copyright 2024