Upcoming SlideShare
×

# Ee443 communications 1 - lab 2 - loren schwappach

927 views

Published on

0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
927
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
62
0
Likes
0
Embeds 0
No embeds

No notes for slide

### Ee443 communications 1 - lab 2 - loren schwappach

1. 1. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 1 Colorado Technical University EE 443 – Communication 1 Lab 2: MATLAB Project – Coherent Detection September 2010 Loren K. Schwappach ABSTRACT: This lab report was completed as a course requirement to obtain full course credit in EE443,Communication 1 at Colorado Technical University. Given a message and a carrier signal, this lab report uses MATLAB todemonstrate the process of coherent detection of a message signal from a modulated signal. All of the code mentioned in thislab report was saved as a MATLAB m-file for convenience, quick reproduction, and troubleshooting of the code. All of the codebelow 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 processused in designing 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. I. INTRODUCTION MATLAB is a powerful program and is useful in thevisualization of mathematics, physics, and appliedengineering. In this lab exercise MATLAB will be used todemonstrate modulation and coherent detection. Given thefollowing: (1) (2) Use MATLAB to investigate the effects of anoscillator’s synchronization with the carrier signal in thecoherent detection process. Figure 1: m(t) = 5cos(2pi*36t)+2sin(2pi*180t). Coherent detection is a process used to recover DSB-SC signals by first multiplying the signal by a local oscillatorsignal with the same frequency and phase as the originalcarrier signal and low pass filtering the result. II. PROCEDURE / RESULTS To demonstrate all of the signals and local oscillatorsynchronization effects, the MATLAB code provided at theconclusion of this report was utilized, and can be saved as anm-file. Furthermore, all of the images in this section can befound at the end of this report in an easier to read format. First the message signal (1) above and the cosine Figure 2: c(t) = 10cos(2pi*1500t).signal (2) above were created and graphed in MATLAB, asillustrated by figures 1 and 2. Next the message and carrier signals were multiplied together resulting in the modulated DSB-SC signal c(t) as illustrated in the time and frequency domains by figures 3,4, and 5 below.
2. 2. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 2 Next, the DSB-SC signal is multiplied by a local oscillator synchronized both in phase and frequency of the original carrier signal c(t) this results in the demodulated output signal as shown by figures 6, 7, and 8. Figure 3: DSB-SC Modulated Signal s(t) in the time domain. Figure 6: DSB-SC Demodulated Signal v(t) in the time domain.Figure 4: DSB-SC Modulated Signal S(f) in the frequency spectrum (2-sided spectrum). Figure 7: DSB-SC demodulated Signal V(f) in the frequency spectrum (2-sided spectrum).Figure 5: DSB-SC Modulated Signal S(f) in the frequency spectrum (positive spectrum). You can see by figures 5 and 6 that DSB-SCmodulation results in shifting the message signal both above Figure 8: DSB-SC Demodulated Signal Y(f) in the(Upper SB) and below (Lower SB) the carrier signal while frequency spectrum (positive spectrum).suppressing the carrier signal as required by DSB-SCmodulation.
3. 3. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 3 You can now see the shape of the original messagesignal m(t) as the maximum positive amplitude, and minimumnegative amplitude of v(t) in figure 6. Figures 7 and 8illustrate that demodulated result puts the message signal m(t)back to its original frequency position. The original signal cannow be recovered using a LP filter to eliminate the highfrequency components. Next to verify the effects of an out of synchronizationlocal oscillator, the local oscillator is first moved out offrequency with the carrier frequency (by .01% and 2%), nextthe local oscillator is moved out of phase with the carrierphase (by 45º , 90º, and 180º). The results are shown byfigures 9-23 below. Figure 11: DSB-SC (.01% Out of Sync LO) Demodulated Signal Y(f) in the frequency spectrum (positive spectrum). Figure 9: DSB-SC (.01% Out of Sync LO) Demodulated Signal v(t) in the time domain. Figure 12: DSB-SC (2% Out of Sync LO) Demodulated Signal v(t) in the time domain.Figure 10: DSB-SC (.01% Out of Sync LO) demodulatedSignal V(f) in the frequency spectrum (2-sided spectrum). Figure 13: DSB-SC (2% Out of Sync LO) demodulated Signal V(f) in the frequency spectrum (2-sided spectrum).
4. 4. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 4 Figure 14: DSB-SC (2% Out of Sync LO) Demodulated Figure 16: DSB-SC (45º Out of Phase LO) demodulatedSignal V(f) in the frequency spectrum (positive spectrum). Signal V(f) in the frequency spectrum (2-sided spectrum). . You can see from figures 9-14 that a small error infrequency synchronization can (2% error (LO=1.47 kHz)) cancompletely eliminate signal recovery. However messagerecover can still occur with a very small error in frequency(<= .01% error (LO=1.49985 kHz). Several additional LO frequencies were tested bychanging the LO error and it was determined that anythinggreater than .01% error would eliminate recovery of themessage signal. Thus, frequency synchronization is extremelyimportant for coherent detection and should be limited to verysmall % error =<.01%. Figure 17: DSB-SC (45º Out of Phase LO) Demodulated Next the effects of phase synchronization are Signal V(f) in the frequency spectrum (positive spectrum).examined and the results are shown by figures 15-23 below. Figure 18: DSB-SC (90º Out of Phase LO) Demodulated Figure 15: DSB-SC (45º Out of Phase LO) Demodulated Signal v(t) in the time domain. Signal v(t) in the time domain.
5. 5. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 5 Figure 19: DSB-SC (90º Out of Phase LO) demodulated Figure 22: DSB-SC (180º Out of Phase LO) demodulatedSignal V(f) in the frequency spectrum (2-sided spectrum). Signal V(f) in the frequency spectrum (2-sided spectrum). Figure 20: DSB-SC (90º Out of Phase LO) DemodulatedSignal V(f) in the frequency spectrum (positive spectrum). Figure 23: DSB-SC (180º Out of Phase LO) Demodulated Signal V(f) in the frequency spectrum (positive spectrum). From figures 15-23 above, it is observed that an increase in the LO phase compared to the carrier phase will gradually attenuate the signal (0º to <90º), until the signal is fully attenuated (90 º). There after the signal will be inverted (>90º to 180º), attenuate the inverted signal (>180º to 270º), and un-invert and increase to max amplitude (270º to 360º). Thus the maximum frequency deviation that will permit signal recovery by the local oscillator is an increase or decrease in phase of the local oscillator by 90 degrees (fully attenuated). The final and bonus part of this lab was to apply a MATLAB command that could filter the DSB-SCFigure 21: DSB-SC (180º Out of Phase LO) Demodulated demodulated output. This is the final step of the coherent Signal v(t) in the time domain. detection process. This was achieved using the “butter” function to create a low pass third order Butterworth filter transfer function at 500 Hz, and the “lsim” function to apply the transfer function to the demodulated time domain output. The results are shown by figures 24-26 below.
6. 6. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 6 For the final part of this lab, the process of coherent detection and filtering is investigated using MATLAB’s Simulink tool set. This was accomplished for a sinusoidal input and a square wave input respectively. For the input sinusoidal wave two sinusoidal inputs were added summed resulting in the sinusoidal input used previously in MATLAB (1). This sinusoidal input was then modulated (multiplied) by the carrier input previously used in MATLAB (2). The resultant DSB-SC modulated wave s(t) is then demodulated (multiplied) by a local oscillator synchronous in frequency and phase with the original carrier frequency c(t)’. The final demodulated output is then filtered to remove the unwanted harmonics restoring our original message signal m(t).Figure 24: DSB-SC Filtered Demodulated Signal v(t) in the time domain. All of these processes are illustrated in the time and frequency domain using Simulink. Figure 25: DSB-SC Filtered demodulated Signal V(f) in the frequency spectrum (2-sided spectrum). Figure 27: Simulink investigation of coherent detection and filtering (sinusoidal input), Overall view. Figure 26: DSB-SC Filtered Demodulated Signal V(f) in the frequency spectrum (positive spectrum). Figure 24 demonstrates successfully that coherentdetection can indeed be used for the recovery of a messagesignal from a DSB-SC modulated signal. Comparing figure24 to Figure 1, the v(t) is indeed the message signal m(t) withan increased magnitude. For example: 34Vpp versus 8Vpp.
7. 7. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 7 Figure 28: Simulink investigation of coherent detection and filtering (sinusoidal input), zoomed for input view. Figure 29:Simulink investigation of coherent detection and filtering (sinusoidal input), zoomed for filtering view.
8. 8. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 8 Figure 30: m1(t) = 5cos(2pi*38t). Figure 33: Modulated DSB-SC wave s(t). Notice result matches MATLAB plot. m(t)*c(t)=s(t). Figure 31: m1(t) = 2sin(2pi*180t). Figure 34: Demodulated wave v(t). Notice Result matches MATLAB plot. s(t)*c(t)’ = v(t). The 1st process of coherent detection is complete. Still need to remove unwanted harmonics.Figure 32: m(t) = 5cos(2pi*36t)+2sin(2pi*180t). Notice the Simulink resultant wave is the same as the result from MATLAB. Figure 35: Filtered demodulated wave v(t). Notice resultant wave looks like our original message m(t). This was accomplished using a 1st order LP Butterworth at 200Hz. The final process of coherent detection is now complete.
9. 9. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 9 Figure 36: Filtered demodulated wave v(t). Notice Figure 38: M(f) frequency spectrum. Notice there are noresultant wave looks somewhat like our original message harmonics. m(t). This was accomplished using a 1st order LP Butterworth at 500Hz. Notice the output still contains several undesired harmonics, the 200Hz LP producedcleaner results. The final process of coherent detection is now complete. Figure 39: Modulated DSB-SC signal S(f) frequency spectrum. Figure 37: Filtered demodulated wave v(t). Noticeresultant wave looks very much like our original message m(t). This was accomplished using a 5th order LP Butterworth at 200Hz. This appears to be the best filter selection. The final process of coherent detection is now complete. Figure 40: Demodulated (unfiltered) signal V(f). Notice the original message is back with several higher frequency harmonics above 1.5 kHz. We can obtain a scaled amplitude m(t) by filtering out these high frequency harmonics.
10. 10. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 10 Next coherent detection and filtering were verified using a square wave input. For the square wave input a pulse wave of 5 amplitude, 50% duty cycle, and a period of 20ms was used. Thereafter the same process used for the sinusoidal wave was used. However, the final filters required modification to allow enough LF component sinusoidal waves (Approx 10*frequency of square wave) in for producing the output square wave. This is because the input square wave is actually made up of several sinusoidal harmonics, and without these harmonics.Figure 41: Demodulated (filtered) signal V(f). Used a 1storder LP Butterworth at 200Hz. Notice the harmonics arenow being attenuated.Figure 42: Demodulated (filtered) signal V(f). Used a 1 storder LP Butterworth at 500Hz. Notice the harmonics arenot as attenuated as they were in figure 41. Thus Figure41 provided a better cutoff frequency for the LP filter. Figure 44: Simulink investigation of coherent detection and filtering (square wave input), Overall view.Figure 43: Demodulated (filtered) signal V(f). Used a 5thorder LP Butterworth at 200Hz. Notice the harmonicsextremely attenuated now, providing a very clean copy ofour original message signal. The final stage of coherentdetection is complete.
11. 11. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 11Figure 45: Simulink investigation of coherent detectionand filtering (square wave input), zoomed for input view. Figure 46: Simulink investigation of coherent detection and filtering (square wave input), zoomed for filtering view.
12. 12. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 12Figure 47: m(t) – square wave in time domain. Figure 50: Filtered demodulated wave, v(t). Filtered using a 1st order Butterworth LP at 50 Hz. Notice we have lost the square wave’s shape by filtering at too low of a frequency. Need to increase the LP cutoff to retrieve the harmonics required by our square wave (A good number is 10*the highest frequency).Figure 48: DSB-SC modulated wave, s(t). Figure 51: Filtered demodulated wave, v(t). Filtered using a 1st order Butterworth LP at 500 Hz. Notice we have retrieved the square wave’s shape by filtering at 500Hz but the order of our Butterworth is still to low. We need a higher order filter to provide a cleaner square wave output.Figure 49: Unfiltered demodulated wave, v(t).
13. 13. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 13Figure 52: Filtered demodulated wave, v(t). Filtered usinga 3rd order Butterworth LP at 500 Hz. Notice we haveretrieved the square wave’s shape and cleaned out the high Figure 55: Demodulated (unfiltered) wave, v(t).frequency noise. This is the best of the three filter designsused. The process of coherent detection is now complete. Figure 56: Demodulated (filtered) wave, V(f). Used a 1 st order LP Butterworth at 50Hz, too low to correctlyFigure 53: M(f) frequency spectrum. Notice the square reproduce square wave.wave is made up of several components, thus a good lowpass filter must take these components into account. Thisis why the best design used a 3rd order Butterworth at 500Hz. Figure 57: Demodulated (filtered) wave, V(f). Used a 1 st order LP Butterworth at 500Hz, the square wave shape is now there but high frequency harmonics are still creating a problem.Figure 54: Modulated DSB-SC signal S(f) frequencyspectrum.
14. 14. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 14Figure 58: Demodulated (filtered) wave, V(f). Used a 3rdorder LP Butterworth at 500Hz, the square wave shape isnow there and the high frequency harmonic noise has beeneliminated. This is the best of the three filter designs used.The process of coherent detection is now complete. III. CONCLUSIONS MATLAB is a great utility for representing complexconcepts visually and can easily be manipulated to showsignals in various formats. This lab project was successful indemonstrating MATLABs powerful features in a quick andeasy method, and demonstrating how MATLAB can be usedfor analyzing complex processes like coherent detection andfiltering visually. This lab illustrated that for coherent detection towork, the local oscillator needs to be in synchronization withthe carrier in both phase and frequency. For coherentdetection the maximum frequency deviation from the carrierhad to be less than .01% of the carrier and less than +-90degrees in phase with the carrier as shown through MATLAB. Finally, the importance of low pass filtering wasexplored, and from it the importance of using good nth orderfilters at a frequency capable of retrieving the originalmessage. The sinusoidal filter proved was easy to designsince only the max frequency needed consideration. Thesquare wave filter design however required further analysis,and it was observed that a cutoff frequency of 10 times thesquare waves frequency was needed. This was a great lab and thoroughly explored theconcepts of coherent detection. REFERENCES nd[1] Haykin, S., “Analog and Digital Communications 2 Edition” John Wiley & Sons, Haboken, NJ, 2007.
15. 15. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 15 Figure 59: m(t) = 5cos(2pi*36t)+2sin(2pi*180t). Figure 60: c(t) = 10cos(2pi*1500t).
16. 16. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 16 Figure 61: DSB-SC Modulated Signal s(t) in the time domain. Figure 62: DSB-SC Modulated Signal S(f) in the frequency spectrum (2-sided spectrum).
17. 17. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 17 Figure 63: DSB-SC Modulated Signal S(f) in the frequency spectrum (positive spectrum). Figure 64: DSB-SC Demodulated Signal v(t) in the time domain.
18. 18. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 18 Figure 65: DSB-SC demodulated Signal V(f) in the frequency spectrum (2-sided spectrum). Figure 66: DSB-SC Demodulated Signal Y(f) in the frequency spectrum (positive spectrum).
19. 19. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 19 Figure 67: DSB-SC (.01% Out of Sync LO) Demodulated Signal v(t) in the time domain. Figure 68: DSB-SC (.01% Out of Sync LO) demodulated Signal V(f) in the frequency spectrum (2-sided spectrum).
20. 20. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 20 Figure 69: DSB-SC (.01% Out of Sync LO) Demodulated Signal Y(f) in the frequency spectrum (positive spectrum). Figure 70: DSB-SC (2% Out of Sync LO) Demodulated Signal v(t) in the time domain.
21. 21. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 21 Figure 71: DSB-SC (2% Out of Sync LO) demodulated Signal V(f) in the frequency spectrum (2-sided spectrum). Figure 72: DSB-SC (2% Out of Sync LO) Demodulated Signal V(f) in the frequency spectrum (positive spectrum).
22. 22. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 22 Figure 73: DSB-SC (45º Out of Phase LO) Demodulated Signal v(t) in the time domain. Figure 74: DSB-SC (45º Out of Phase LO) demodulated Signal V(f) in the frequency spectrum (2-sided spectrum). .
23. 23. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 23 Figure 75: DSB-SC (45º Out of Phase LO) Demodulated Signal V(f) in the frequency spectrum (positive spectrum). Figure 76: DSB-SC (90º Out of Phase LO) Demodulated Signal v(t) in the time domain.
24. 24. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 24 Figure 77: DSB-SC (90º Out of Phase LO) demodulated Signal V(f) in the frequency spectrum (2-sided spectrum). Figure 78: DSB-SC (90º Out of Phase LO) Demodulated Signal V(f) in the frequency spectrum (positive spectrum).
25. 25. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 25 Figure 79: DSB-SC (180º Out of Phase LO) Demodulated Signal v(t) in the time domain. Figure 80: DSB-SC (180º Out of Phase LO) demodulated Signal V(f) in the frequency spectrum (2-sided spectrum).
26. 26. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 26 Figure 81: DSB-SC (180º Out of Phase LO) Demodulated Signal V(f) in the frequency spectrum (positive spectrum).
27. 27. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 27 Figure 82: Simulink investigation of coherent detection and filtering (sinusoidal input), Overall view.
28. 28. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 28 Figure 83: Simulink investigation of coherent detection and filtering (sinusoidal input), zoomed for input view.
29. 29. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 29 Figure 84:Simulink investigation of coherent detection and filtering (sinusoidal input), zoomed for filtering view.
30. 30. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 30 Figure 85: m1(t) = 5cos(2pi*38t). Figure 86: m1(t) = 2sin(2pi*180t).
31. 31. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 31 Figure 87: m(t) = 5cos(2pi*36t)+2sin(2pi*180t). Notice the Simulink resultant wave is the same as the result from MATLAB. Figure 88: Modulated DSB-SC wave s(t). Notice result matches MATLAB plot. m(t)*c(t)=s(t).
32. 32. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 32 Figure 89: Demodulated wave v(t). Notice Result matches MATLAB plot. s(t)*c(t)’ = v(t). The 1 st process of coherent detection is complete. Still need to remove unwanted harmonics. Figure 90: Filtered demodulated wave v(t). Notice resultant wave looks like our original message m(t). This was accomplished using a 1st order LP Butterworth at 200Hz. The final process of coherent detection is now complete.
33. 33. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 33 Figure 91: Filtered demodulated wave v(t). Notice resultant wave looks somewhat like our original message m(t). This was accomplished using a 1st order LP Butterworth at 500Hz. Notice the output still contains several undesired harmonics, the 200Hz LP produced cleaner results. The final process of coherent detection is now complete.
34. 34. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 34 Figure 92: Filtered demodulated wave v(t). Notice resultant wave looks very much like our original message m(t). This was accomplished using a 5th order LP Butterworth at 200Hz. This appears to be the best filter selection. The final process of coherent detection is now complete. Figure 93: M(f) frequency spectrum. Notice there are no harmonics.
35. 35. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 35 Figure 94: Modulated DSB-SC signal S(f) frequency spectrum. Figure 95: Demodulated (unfiltered) signal V(f). Notice the original message is back with several higher frequency harmonics above 1.5 kHz. We can obtain a scaled amplitude m(t) by filtering out these high frequency harmonics.
36. 36. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 36Figure 96: Demodulated (filtered) signal V(f). Used a 1 st order LP Butterworth at 200Hz. Notice the harmonics are now being attenuated. Figure 97: Demodulated (filtered) signal V(f). Used a 1 st order LP Butterworth at 500Hz. Notice the harmonics are not as attenuated as they were in figure 41. Thus Figure 41 provided a better cutoff frequency for the LP filter.
37. 37. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 37 Figure 98: Demodulated (filtered) signal V(f). Used a 5th order LP Butterworth at 200Hz. Notice the harmonics extremely attenuated now, providing a very clean copy of our original message signal. The final stage of coherent detection is complete.
38. 38. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 38 Figure 99: Simulink investigation of coherent detection and filtering (square wave input), Overall view.
39. 39. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 39 Figure 100: Simulink investigation of coherent detection and filtering (square wave input), zoomed for input view.
40. 40. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 40 Figure 101: Simulink investigation of coherent detection and filtering (square wave input), zoomed for filtering view.
41. 41. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 41 Figure 102: m(t) – square wave in time domain. Figure 103: DSB-SC modulated wave, s(t).
42. 42. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 42 Figure 104: Unfiltered demodulated wave, v(t).Figure 105: Filtered demodulated wave, v(t). Filtered using a 1 st order Butterworth LP at 50 Hz. Notice we have lost the square wave’s shape by filtering at too low of a frequency. Need to increase the LP cutoff to retrieve the harmonics required by our square wave (A good number is 10*the highest frequency).
43. 43. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 43 Figure 106: Filtered demodulated wave, v(t). Filtered using a 1st order Butterworth LP at 500 Hz. Notice we haveretrieved the square wave’s shape by filtering at 500Hz but the order of our Butterworth is still to low. We need a higher order filter to provide a cleaner square wave output. Figure 107: Filtered demodulated wave, v(t). Filtered using a 3rd order Butterworth LP at 500 Hz. Notice we have retrieved the square wave’s shape and cleaned out the high frequency noise. This is the best of the three filter designs used. The process of coherent detection is now complete.
44. 44. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 44 Figure 108: M(f) frequency spectrum. Notice the square wave is made up of several components, thus a good low pass filter must take these components into account. This is why the best design used a 3 rd order Butterworth at 500 Hz. Figure 109: Modulated DSB-SC signal S(f) frequency spectrum.
45. 45. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 45 Figure 110: Demodulated (unfiltered) wave, v(t).Figure 111: Demodulated (filtered) wave, V(f). Used a 1 st order LP Butterworth at 50Hz, too low to correctly reproduce square wave.
46. 46. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 46Figure 112: Demodulated (filtered) wave, V(f). Used a 1st order LP Butterworth at 500Hz, the square wave shape is now there but high frequency harmonics are still creating a problem.Figure 113: Demodulated (filtered) wave, V(f). Used a 3rd order LP Butterworth at 500Hz, the square wave shape is now there and the high frequency harmonic noise has been eliminated. This is the best of the three filter designs used. The process of coherent detection is now complete.
47. 47. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 47%---------------------------% MATLAB CODE%---------------------------function Lab2 = Comm1Lab2() %Function name for calling in MATLAB% Colorado Technical University% EE 443 - Communications I% Lab 2 - MATLAB Project - Coherent Detection% By Loren K. Schwappach% Uses centeredFFT() for obtaining a two-sided spectrum%---------------------------% Generating Carrier, Message and Modulated wavefc = 1500;ac = 10;cPhi = 0;fm1 = 36; %frequency of the first sinusodial waveam1 = 5; %amplitude of the first sinusodial wavefm2 = 180; %frequency of the second sinusodial waveam2 = 2; %amplitude of the second sinusodial wavefs = 10*fc; %sampling frequencyts = 1/fs; %sampling intervalt = 0:ts:1-ts; %time vectorm = (am1*cos(2*pi*fm1*t) + am2*cos(2*pi*fm2*t)); %composite message wavec = ac*cos(2*pi*fc*t + cPhi); %carrier wavest = m.*c;% Plot of Message in Time DomaintimePlot = figure; %gives graph window a name and keeps it availableplot (t(1:500),m(1:500)); %plots sinusodial wave in time domaintitle(Message - Time domain);xlabel(Time (s)); %adds xlabel to graphylabel(Amplitude); %adds ylabel to graphgrid; %turns on gridaxis([0,27.5e-3,-8,8]); %defines axis [x(min),x(max),y(min),y(max)]% Plot of Carrier in Time DomaintimePlot = figure; %gives graph window a name and keeps it availableplot (t(1:200),c(1:200)); %plots sinusodial wave in time domaintitle(Carrier - Time domain);xlabel(Time (s)); %adds xlabel to graphylabel(Amplitude); %adds ylabel to graphgrid; %turns on gridaxis([2e-3,6e-3,-10,10]); %defines axis [x(min),x(max),y(min),y(max)]% Plot of Modulated Wave in Time DomaintimePlot = figure; %gives graph window a name and keeps it availableplot (t(1:500),st(1:500)); %plots sinusodial wave in time domaintitle(DBS-SC Modulated Signal - Time domain);xlabel(Time (s)); %adds xlabel to graphylabel(Amplitude); %adds ylabel to graphgrid; %turns on gridaxis([6.5e-3,21e-3,-80,80]); %defines axis [x(min),x(max),y(min),y(max)]% Plot of Modulated Wave in Frequency Domain[Sf,SfRange] = centeredFFT(st,fs); %Uses centeredFFT functionfreqPlot = figure; %gives graph window a name and keeps it availablestem(SfRange,Sf); %Creates stem graph for magnitude spectrum
48. 48. CTU: EE 443 – Communications 1: Lab 2: MATLAB Project – Coherent Detection 48title(DBS-SC Modulated - 2 Sided Spectrum)xlabel(Freq (Hz)); %adds xlabel to graphylabel(Amplitude); %adds ylabel to graphgrid; %turns on gridaxis([-2000,2000,-1,13]); %defines axis [x(min),x(max),y(min),y(max)]% Plot of Modulated Wave in Frequency Domain - Close UpfreqPlot = figure; %gives graph window a name and keeps it availablestem(SfRange,Sf); %Creates stem graph for magnitude spectrumtitle(DBS-SC Modulated - Pos Spectrum Closeup)xlabel(Freq (Hz)); %adds xlabel to graphylabel(Amplitude); %adds ylabel to graphgrid; %turns on gridaxis([1200,1800,-1,13]); %defines axis [x(min),x(max),y(min),y(max)]% ---------------------------------------------% In Phase & Freq Demod Segment% Plot of Demodulated Wave in Time DomaincPhib = cPhi; %In phase with carrierfcb = fc; %In frequency with carrierr = cos(2*pi*fcb*t+cPhib).*st; %Multiplies LO with s(t)timePlot = figure; %gives graph window a name and keeps it availableplot (t(1:500),r(1:500)); %plots sinusodial wave in time domaintitle(DBS-SC Demodulated Signal - Time domain);xlabel(Time (s)); %adds xlabel to graphylabel(Amplitude); %adds ylabel to graphgrid; %turns on gridaxis([0,27.5e-3,-80,80]); %defines axis [x(min),x(max),y(min),y(max)]% Plot of Demodulated Wave in Frequency Domain[Rf,RfRange] = centeredFFT(r,fs); %Uses centeredFFT functionfreqPlot = figure; %gives graph window a name and keeps it availablestem(RfRange,Rf); %Creates stem graph for magnitude spectrumtitle(DBS-SC DeModulated - 2 Sided Spectrum)xlabel(Freq (Hz)); %adds xlabel to graphylabel(Amplitude); %adds ylabel to graphgrid; %turns on gridaxis([-500,500,-1,13]); %defines axis [x(min),x(max),y(min),y(max)]% Plot of Demodulated Wave in Frequency Domain - Close UpfreqPlot = figure; %gives graph window a name and keeps it availablestem(RfRange,Rf); %Creates stem graph for magnitude spectrumtitle(DBS-SC DeModulated - Pos Spectrum Closeup)xlabel(Freq (Hz)); %adds xlabel to graphylabel(Amplitude); %adds ylabel to graphgrid; %turns on gridaxis([0,200,-1,13]); %defines axis [x(min),x(max),y(min),y(max)]% ---------------------------------------------% Out of Freq Demod Segment% Plot of Out of Freq Demodulated Wave in Time DomainFreqOffset = .9999; % .01% errorcPhib = cPhi; %In phase with carrierfcb = fc*FreqOffset; %Out of frequency with carrierr = cos(2*pi*fcb*t+cPhib).*st;timePlot = figure; %gives graph window a name and keeps it availableplot (t(1:500),r(1:500)); %plots sinusodial wave in time domain