1.
CTU: EE 463 – Communications 2: Lab 1: MATLAB Project – Sampling 1 Colorado Technical University EE 463 – Communications 2 Lab 1: MATLAB Project – Sampling October 2010 Loren K. Schwappach ABSTRACT: This lab report was completed as a course requirement to obtain full course credit in EE463,Communications 2 at Colorado Technical University. This Lab investigates the concepts of sampling, aliasing, and recovery ofsignals after sampling. In addition this lab explores the similarities between amplitude modulated signals and sampling. All ofthe code mentioned in this lab report was saved as a MATLAB m-file for convenience, quick reproduction, and troubleshootingof the code. All of the code below can also be found at the end of the report as an attachment, as well as all figures. If you have any questions or concerns in regards to this laboratory assignment, this laboratory report, the process used indesigning the indicated circuitry, or the final conclusions and recommendations derived, please send an email toLSchwappach@yahoo.com. All computer drawn figures and pictures used in this report are of original and authentic content. IV. PROCEDURE / RESULTS I. INTRODUCTION MATLAB is a powerful program and is helpful in the The procedures used in this lab are illustrated by thevisualization of applied mathematics, physics, and practical included MATLAB code (not applicable for this labengineering. In this lab assignment MATLAB’s Simulink assignment) and Simulink diagrams (applicable) in this report.tools are used to explore the generation, recovery, and aliasing This Simulink diagrams can also be found at the end of thisof a sampled signal. report as attachments for easier visibility. 1. Part A – Generating A Sampled Message II. OBJECTIVES For the first part of this lab assignment (Part A), Simulink is used to demonstrate the concept of sampling. In this communications 2 lab exercise MATLAB willbe used to accomplish the following objectives: Sampling of the frequency domain is accomplished by multiplying a message signal with a non-zero average value1. Demonstrate the concepts of sampling, aliasing and the sampling signal (pulse) at a sampling frequency that at the recovery of signals from a sampled signal. very least exceeds the Nyquist frequency.2. Demonstrate the relationship between amplitude For this part of the lab assignment a 10 Hertz Sine modulation and sampling. wave message and 10 Hertz Pulse message are independently sampled.3. Apply the concept of sampling to envelope detection. The effects of biasing of a sinusoidal message are also explored as well as the effect of using a zero average sampling pulse over a non-zero average pulse, however the III. EQUIPMENT effects are not apparent until message recovery is completed in Part B. The following tools and or equipment were used forthis lab assignment: First this lab will examine the effects of using a 10 Hertz biased sine wave (Figure 1).1. MATLAB version 2009b to 2010a.2. Simulink (Part of MATLAB)3. Communications Toolbox (Part of Simulink)
2.
CTU: EE 463 – Communications 2: Lab 1: MATLAB Project – Sampling 2 Figure 3: sampled(t). Figure 4 below shows the biased 10 Hertz Sine wave in the frequency domain and its corresponding frequencies (10 Hertz, -10 Hertz, and DC 0 Hertz bias.)Figure 1: Lab 1 Part A Sine Wave Input. Figure 1 above was designed in Simulink to alloweither a 10 Hertz sine wave or 10 Hertz pulse. The 10 Hertzsine wave is chosen first and the results displaying the correctfrequency results and DC biasing are shown by Figure 2. Figure 4: M(f) biased message. Figure 5 below shows the sampled biased sine wave in the frequency domain. In the frequency domain you can see several duplicates of the message signal as well as theFigure 2: m(t) biased message. original message signal. The duplicates (samples) of the message signal are located (centered) at harmonics (multiples) Figure 3 below shows the time domain results of of the sampling frequency.sampling the biased sine wave with a Sampling pulsegenerator that is sampling at a frequency slightly higher than It can already be seen that by biasing the messagethe Nyquist frequency. In this case 20.2 Hertz is chosen as the signal prior to sampling we achieve what looks to be severalsampling frequency which exceeds the Nyquist theorem (A amplitude modulated (AM) signals in the frequency domain.signal must be sampled by a sampling frequency that is at least If we were to filter out one of these sampling harmonics wetwice as high as the highest message frequency.) would be left with a result very similar to an AM wave. This concept will be explored later in this lab.
3.
CTU: EE 463 – Communications 2: Lab 1: MATLAB Project – Sampling 3 Figure 7: m(t) unbiased message.Figure 5: Sampled(f) As observed by Figure 5 above sampling results infrequencies at 0 Hz, +-10Hz (original signal (fm)) as well asseveral clones of the sampled signal centered at the samplingfrequency (fs) and its harmonics (n*fs). So the sampledspectrum contains n*fs+-fm. Next an analysis of biasing the message signal isfurther explored by un-biasing the 10 Hertz sine wave asshown by Figure 6. Figure 8: sampled(t). The results of Figures 7 and 8 are as expected as well as the spectrum (frequency domain) results shown by Figure 9 and 10. It can already be seen that by un-biasing the message signal prior to sampling we achieve what looks to be several double sideband suppressed carrier (DSB-SC) signals in the frequency domain. If we were to filter out one of these sampling harmonics we would be left with a result very similar to a DSB-SC wave. This concept will be explored later in this lab.Figure 6: Lab 1 Part A Sine Zero Bias. The unbiased sine wave transient analysis (timedomain) results can be observed by Figure 7. And thecorresponding sampling results can be seen in Figure 8. Figure 9: M(f) unbiased.
4.
CTU: EE 463 – Communications 2: Lab 1: MATLAB Project – Sampling 4 Figure 12: pulse m(t).Figure 10: Sampled(f). Next, our sine wave source is replaced with a 10Hertz pulse wave as shown by Figure 11. A pulse in the timedomain results in a sinc function in the frequency domain.Thus, in-order to accurately represent a pulse wave you needto capture at least ten harmonic frequencies created as a resultof the sinc function. Since our pulse is a 10 hertz we shouldhave an accurate representation of the pulse by grabbingfrequencies up to 11* pulse frequency. Now letting this highfrequency become the highest frequency of the pulse wave oursampling rate should be slightly higher than twice the highest Figure 13: sampled(t).message frequency. This ensures a sampling rate of at least222.2 Hertz and is the frequency used by our sampling pulse Figure 14 illustrates the 10 Hertz pulse in thegenerator in Figure 11. frequency domain (representing the magnitude of a sinc) and Figure 15 illustrates the sampled pulse in the frequency domain. As observed by Figure 15 the sampling results in frequencies of the original signal as well as several clones of the sampled signal centered at the sampling frequencies (fs) and its harmonics (n*fs). So the sampled spectrum contains n*fs+-fm.Figure 11: Lab 1 Part A Pulse. Figure 12 illustrates the 10 Hertz pulse in the timedomain and Figure 13 illustrates the sampled pulse in the timedomain. Figure 14: M(f).
5.
CTU: EE 463 – Communications 2: Lab 1: MATLAB Project – Sampling 5 Figure 17: pulse m(t).Figure 15: Sampled(f). For the last part of Part A, a constant (-5) DC signalis added to our sampling pulse making the sampling pulsehave a zero-average value. This has the effect of cancelingout our DC pulse components and will cause the signal to beunrecoverable in Part B of this lab report. This is done inSimulink as shown by Figure 16. Figure 18: sampled(t). The results of using the zero average sampler are shown by Figures 17 and 18 in the time domain and by Figures 19 and 20 in the frequency domain. As expected and shown by Figure 20 by using a zero average sampling function we have eliminated several critical pieces of our message signal (effectively canceled out the DC pulse components.) Without these components recovery of our message signal will be impossible. Thus the sampling function must have a non-zero average value. This concept will gain further validity after we attempt message recovery in Part 2.Figure 16: Lab 1 Part A Pulse (Zero Avg. Sampler).
6.
CTU: EE 463 – Communications 2: Lab 1: MATLAB Project – Sampling 6 First we will attempt recovery of our original sampled 10 Hertz sine wave using a sampling rate only slightly higher than the Nyquist rate and a 5th order Butterworth low-pass (LP) filter as shown by Figure 21.Figure 19: M(f). Figure 21: Lab 1 Part B Sine. Nyquist Sampled. As shown by figure 22, using a sampling rate only slightly (1%) higher than the Nyquist is insufficient for message recovery since an ideal LP filter is unrealistic. The frequency components displayed by Figure 23 contain more than the original message (although hard to observe). Thus we need to increase our sampling rate in order to decrease our LP filter approximation.Figure 20: Sampled(f). Sampled using Zero Averagevalue pulse. Notice the missing DC components. 2. Part 2 – Recovery of a Sampled Message For the second part of this lab assignment (Part B),Simulink is used to demonstrate the concept of messagerecovery from a sampled message. Figure 22: recovered(t) recovered poorly using Nyquist Since sampling results in the original message Sampling Rate.frequencies as well as several clones of the original messagefrequencies centered at the sampling frequency (fs) and itsharmonics (n*fs). Recovery of the message should bepossible by low pass filtering the original message from thesampled harmonics. This should be possible so long as the samplingfrequency is at least twice as high as the highest frequencycomponent of the message frequency. Furthermore, since ideal LP filters are hard to comeby we should further increase our chances of successfulmessage recovery by a further boost to our samplingfrequency.
7.
CTU: EE 463 – Communications 2: Lab 1: MATLAB Project – Sampling 7 Figure 25: recovered(t) recovered nicely by over sampling.Figure 23: Recovered(f) recovered poorly using Nyquistsampling rate. Next the sampling rate is adjusted to a rate muchhigher than the Nyquist (fm*5 versus fm*2). This shouldensure greater probability of message recovery. This wasaccomplished using the Simulink model displayed by Figure24. Figure 26: recovered(t) recovered nicely by over sampling. Next our input sources are changed and an attempt at recovering our original 10 Hertz pulse using a sampling rate much higher than the Nyquist (fm*5 versus fm*2) is attempted. This was accomplished using the model illustrated by Figure 27.Figure 24: Lab 1 Part B Sine. Over Sampled. Figure 25 shows that our original sine wave wassuccessfully recovered using the higher sampling rate of 5*fm.This allowed the 5th order Butterworth LP filter to effectivelyeliminate the harmonic sampling components created throughthe sampling process. Figure 26 shows the successfulrecovery of the message in the frequency domain. Figure 27: Lab 1 Part B Pulse. Over sampled and recovered. It has already been shown that a pulse in the time domain results in a sync in the frequency domain, and we can
8.
CTU: EE 463 – Communications 2: Lab 1: MATLAB Project – Sampling 8approximate a pulse by capturing as many harmonics in thefrequency domain as possible. However, to reduce bandwidth we can achieve aclose approximation to our pulse by limiting the pulse toapproximately 10 harmonics. Thus, for this lab assignment fm* 11 was chosen as the highest frequency component of thepulse. As Figure 28 illustrates successful recovery of thepulse was accomplished by using a high sampling rate andcapturing LP filtering out the sampling resultant frequencies. If the sampling had been too low aliasing could haveoccurred making message recovery impossible. This conceptis explored further in Part C. Figure 30: Lab 1 Part B Pulse Recovery with Zero Avg. Sampling. As a result of using a zero average value function versus a non-zero average value function we effectively eliminate our DC message components when sampling and make message recovery very improbable. The time domain results of this concept are shown by Figure 31 which looks nothing like our original pulse! The frequency domain results shown by Figure 32 show the elimination of the messages DC components.Figure 28: recovered(t) recovered nicely by over sampling. Figure 31: recovered(t). Recovery was not successful due to Zero Avg. Sampling frequency.Figure 29: Sampled(f) Next a final proof of the effects of using a zeroaverage value sampling function is explored by again adding aconstant (-0.5) to our sampling pulse as shown by Figure 30.
9.
CTU: EE 463 – Communications 2: Lab 1: MATLAB Project – Sampling 9 Thus even if we were to use an ideal low pass filter capable of capturing all of the original message frequencies (frequencies < 10 Hertz), we would still capture an extra frequency due to the aliasing caused by sampling lower than the Nyquist frequency as shown by equation 4: et et et As you can see 5 Hertz is less than our 10 Hertz message frequency so our resultant low pass filter would output both frequencies (5 Hertz and 10 Hertz). This is not the recovered output we expected and thus aliasing has made recovery of this message signal impossible. To further explore this concept graphically the following Simulink model was build using our previousFigure 32: Sampled(f). Message unrecovered due to Zero MATLAB concepts (10 Hertz sine message with a samplingAvg. value of sampling pulse. of 15 Hertz) as shown by Figure 33. 3. Part 3 – Aliasing Aliasing refers to an effect which causes differentsignals to become indistinguishable due to sampling. Thealiasing effect can make recover of a message signalimpossible when the sampling rate is too low and effectivelycauses samples to shift into the original message. Thus, aliasing can easily be caused and observed bysampling at a rate that is lower than the Nyquist rate. To demonstrate aliasing we can use our original 10Hertz sine wave message and modify the sampling rate to belower than the Nyquist rate. For this lab assignmentdemonstration a sampling rate of 1.5 times the message waschosen. Figure 33: Lab 1 Part C Aliasing. Mathematically aliasing will result in the following As illustrated by Figure 34 the resultant recoveredfrequency components: message m(t) is no longer composed of a single sine wave but seems to be a composite sinusoidal. Figure 35 further confirms this and shows the additional frequency (5 Hertz) M component in our frequency spectrum. ulse ulse M S mple So suppose we use a 10 Hertz sine wave message. Ifwe sample below the Nyquist minimum frequency at say 1.5times the message, the sampled message would be composedof the message frequencies and the addition of the samplescentered above and below the sampling frequency and itsmultiples. If the sampling frequency (fs) is 1.5 times themessage frequency then the sampling frequency must be 15Hertz. The samples appear both above and below this Figure 34: recovered(t). Unrecovered message caused bysampling frequency as described by equation 3: aliasing. Sampling rate < Nyquist rate.
10.
CTU: EE 463 – Communications 2: Lab 1: MATLAB Project – Sampling 10 Figure 37: m(t). Biased. Figure 38 shows the sampled message in the timeFigure 35: Recovered(f). Unrecovered message caused by domain. However we still need to filter out the extraaliasing. Sampling rate < Nyquist rate. frequency components adding to the pulse form of the output. By using a band-pass filter with a lower pass-band fs-fm and 4. Part 4 – AM & DSB-SC Wave creation upper pass-band fs+fm we get the correct AM result as shown through sampling. by Figure 39. An amplitude modulated wave is represented in thetime domain mathematically by: A Looking at this equation we can observe that a AMwave is produced by multiplying a zero average samplingfunction (like a sine or cosine) with a biased message signaland then filtering (Band Pass) out the AM wave (remember(Figure 36) sampling will make numerous copies eachcentered at the sampling frequency) which contains aduplicate of the message above the sampling frequency and aduplicate of the message reflected below the messagefrequency. So long as the message sinusoidal is biased Figure 38: sampled(t).(contains a DC value) the filtered result is an AM wave. If themessage sinusoidal is unbiased the result will be a DSB-SCwave. Figure 39: AM filtered(t). After filtering result is AM wave.Figure 36: Lab 1 Part D Amplitude Modulated Signal.Biased Sine and Zero Avg. Sampling.
11.
CTU: EE 463 – Communications 2: Lab 1: MATLAB Project – Sampling 11Figure 40: M(f). Figure 42: m(t). Figure 44 below correctly demonstrates an AM(DSB-LC) wave created using a biased message, zero averagesampling, and band pass filtering. Figure 43: sampled(t).Figure 44: AM Filtered(f). Next to demonstrate a DSB-SC wave we need tounbias the sinusoidal message. This will remove the DC(carrier) of the DSB-LC (AM) wave. This was accomplishedin Simulink using Figure 41. Figure 44: AM filtered(t). The spectrum results required by a DSB-SC wave are correctly illustrated by Figure 47. Thus we have proved that you can create an AM wave and a DSB-SC wave using bandpass filtering and zero averaged sampling.Figure 41: Lab 1 Part D DSB-SC. Unbiased m(t).
12.
CTU: EE 463 – Communications 2: Lab 1: MATLAB Project – Sampling 12 V. CONCLUSIONS In conclusion this lab has demonstrated the concepts of sampling (Part A), aliasing (Part C) and the recovery (Part B) of signals from a sampled signal. Finally this assignment has applied the concept of sampling to amplitude modulation and DSB-SC modulation. It was demonstrated that by using the Nyquist frequency as the sampling frequency we can mathematically avoid aliasing and sample the signal in such a way as to allow signal recovery through low-pass filtering. However sinceFigure 45: M(f). ideal LP filters are very improbable and a using a higher sampling rate decreases the filter design constraints it is often better to use a sampling rate higher than the Nyquist rate. Finally by using a zero average sampling function and band-pass filtering we can achieve what appears to be an AM or DSB-SC signal in the frequency domain. Whether or not the carrier is present (AM vs. DSB-SC) is dependent upon the presence of a bias on the message signal. REFERENCES [1] ykin, S , “An log n Digit l Communi tions 2nd Edition” John Wiley & Sons, boken, NJ, 2007.Figure 46: Sampled(f). Figure 47 below correctly illustrates a DSB-SCspectrum.Figure 47: DSB-SC Filtered(f).
13.
CTU: EE 463 – Communications 2: Lab 1: MATLAB Project – Sampling 13 Figure 48: Lab 1 Part A Sine Wave Input. Figure 49: Lab 1 Part A Sine Zero Bias.
14.
CTU: EE 463 – Communications 2: Lab 1: MATLAB Project – Sampling 14 Figure 50: Lab 1 Part A Pulse. Figure 51: Lab 1 Part A Pulse (Zero Avg. Sampler).
15.
CTU: EE 463 – Communications 2: Lab 1: MATLAB Project – Sampling 15 Figure 52: Lab 1 Part B Sine. Nyquist Sampled. Figure 53: Lab 1 Part B Pulse Recovery with Zero Avg. Sampling.
16.
CTU: EE 463 – Communications 2: Lab 1: MATLAB Project – Sampling 16 Figure 54: Lab 1 Part C Aliasing. Figure 55: Lab 1 Part D Amplitude Modulated Signal. Biased Sine and Zero Avg. Sampling.
17.
CTU: EE 463 – Communications 2: Lab 1: MATLAB Project – Sampling 17 Figure 56: Lab 1 Part D DSB-SC. Unbiased m(t).
Views
Actions
Embeds 0
Report content