This document is a lab report describing frequency modulation and detection using MATLAB. It includes:
1) Frequency modulating a carrier signal with a message signal in MATLAB and plotting the modulated signal in time and frequency domains using different modulation indexes to demonstrate narrowband, wideband, and carrier-dropped scenarios.
2) Using Simulink to frequency modulate a square wave message onto a carrier signal with a VCO and partially demodulating using slope detection.
3) Generating white noise in MATLAB, plotting it in time and frequency domains, and finding its autocorrelation function.
CTU: EE 443 Lab 3 - MATLAB FM Modulation, Detection & Noise
1. CTU: EE 443 – Communications 1: Lab 3: MATLAB Project – Frequency Modulation / Detection and Noise 1
Colorado Technical University
EE 443 – Communication 1
Lab 2: MATLAB Project – Frequency Modulation / Detection
and Noise
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 to
demonstrate the process of frequency modulation and demodulation of the message using a VCO. All of the code mentioned
in this lab report was saved as a MATLAB m-file for convenience, quick reproduction, and troubleshooting of 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. All of the code and images
created for this report are authentic and of my sole content. Since I finished 90 percent of this lab ahead of my struggling peers
I shared snippets of my code with a few students (Shawn Malone, and Crystal Brandy) to aid in their understanding of the this
lab and assisted them in working through Simulink although they will need to provide their own lab reports with their own
content.
If you have any questions or concerns in regards to this laboratory assignment, this laboratory report, the process
used in designing the indicated circuitry, or the final conclusions and recommendations derived, please send an email to
LSchwappach@yahoo.com. All computer drawn figures and pictures used in this report are of original and authentic content.
Finally Simulink is used to show what happens to a
I. INTRODUCTION sinusoidal signal after noise is added, and then removed via a
The purpose of this lab is to learn how to low pass filter, next the signal is replaced with a square wave
characterize a Frequency modulated (FM) signal input, finally the signal is passed though a slope detector and
mathematically and simulate the frequency modulation of an analyzed.
input signal using MATLABs Simulink software. This lab also
serves as an introduction into the effects of noise on a system
and how to plot noise in MATLAB. III. PROCEDURE / RESULTS
The procedures used in this lab are illustrated by the
II. OBJECTIVES included MATLAB code and Simulink diagrams in this report.
There are three tasks that need to be completed for
1. Part 1 – FM Modulation in MATLAB
this lab assignment.
To begin this lab a time vector ‘t’ is created as well as
The first task is to frequency modulate a signal in the corresponding message and carrier signal components as
MATLAB and plot the FM signal in the time and frequency shown bellow...
domain, and then select values of Beta which can simulate
narrow band (NB) FM, wideband (WB) FM, and an FM signal % Generating Carrier, Message and Modulated wave
Fc = 500;
without a carrier (dropped carrier scenario). Ac = 2;
Pc = 0;
Fm = 25;
The second task is to frequency modulate a signal Am = 1;
using a Voltage-Controlled Oscillator (VCO) in Simulink and Pm = 0;
then use a transfer function to simulate a slope detector Beta = 0;
fs = 5000; %sampling frequency
circuit such that the slope detector output is a combination of ts = 1/fs; %sampling interval
FM and AM. t = 0:ts:((1/Fm)*3); %time vector
The third and final tasks involves noise. First a noise Next the components were put together to display
signal is generated and graphed in MATLAB, next the our message wave and carrier wave as shown below..
autocorrelation function of the noise signal is created.
2. CTU: EE 443 – Communications 1: Lab 3: MATLAB Project – Frequency Modulation / Detection and Noise 2
m = Am*sin(2*pi*Fm*t + Pm); %message wave
c = Ac*sin(2*pi*Fc*t + Pc); %carrier wave
The final FM modulated signal is of the form..
st = Ac*sin(2*pi*Fc*t+Beta*sin(2*pi*Fm*t)); %FM
signal
This frequency modulated signal was then plot in the
time domain and in the frequency domain using various
values of Beta needed to demonstrate NB, WB, and carrier
missing FM as shown.
% ------- B = .1
Beta = .1;
st = Ac*sin(2*pi*Fc*t+Beta*sin(2*pi*Fm*t)); %FM
signal
% Plot of FM signal in Time Domain
timePlot = figure; %gives graph window a name and
keeps it available
plot (t,st); %plots FM signal in time domain
title('FM Signal (B=.1) - Time domain'); %adds title
to graph Figure 2: FM Signal Beta = .1 in the frequency domain.
xlabel('Time (s)'); %adds xlabel to graph
ylabel('Amplitude'); %adds ylabel to graph
Notice there are very few sideband frequencies making up
grid; %turns on grid the message signal thus the low bandwidth (Narrowband)
axis([0,40e-3,-2,2]); %defines axis
[x(min),x(max),y(min),y(max)] % Plot of Modulated Wave in Frequency Domain - Close
Up
freqPlot = figure; %gives graph window a name and
keeps it available
stem(SfRange,Sf); %Creates stem graph for magnitude
spectrum
title('FM Signal (B=.1) - Pos Spectrum Closeup')
xlabel('Freq (Hz)'); %adds xlabel to graph
ylabel('Amplitude'); %adds ylabel to graph
grid; %turns on grid
axis([400,600,-.1,.4]); %defines axis
[x(min),x(max),y(min),y(max)]
Figure 1: FM Signal, Beta = .1 in the time domain.
% Plot of FM Signal in Frequency Domain
[Sf,SfRange] = centeredFFT(st,fs); %Uses centeredFFT
function
freqPlot = figure; %gives graph window a name and
keeps it available
stem(SfRange,Sf); %Creates stem graph for magnitude
spectrum
title('FM Signal (B=.1) - 2 Sided Spectrum') %adds
title to graph Figure 3: FM Signal Beta = .1 in the frequency domain
xlabel('Freq (Hz)'); %adds xlabel to graph (Close-up). Notice there are very few sideband frequencies
ylabel('Amplitude'); %adds ylabel to graph
grid; %turns on grid
making up the message signal thus the low bandwidth
axis([-800,800,-.1,.4]); %defines axis (Narrowband)
[x(min),x(max),y(min),y(max)]
3. CTU: EE 443 – Communications 1: Lab 3: MATLAB Project – Frequency Modulation / Detection and Noise 3
% ------- B = 5
Beta = 5;
st = Ac*sin(2*pi*Fc*t+Beta*sin(2*pi*Fm*t)); %FM
signal
% Plot of FM signal in Time Domain
timePlot = figure; %gives graph window a name and
keeps it available
plot (t,st); %plots FM signal in time domain
title('FM Signal (B=5) - Time domain'); %adds title
to graph
xlabel('Time (s)'); %adds xlabel to graph
ylabel('Amplitude'); %adds ylabel to graph
grid; %turns on grid
axis([0,40e-3,-2,2]); %defines axis
[x(min),x(max),y(min),y(max)]
Figure 5: FM Signal Beta = 5 in the frequency domain.
Notice there are many sideband frequencies making up the
message signal thus the higher bandwidth (Wideband)
% Plot of Modulated Wave in Frequency Domain - Close
Up
freqPlot = figure; %gives graph window a name and
keeps it available
stem(SfRange,Sf); %Creates stem graph for magnitude
spectrum
title('FM Signal (B=5) - Pos Spectrum Closeup')
xlabel('Freq (Hz)'); %adds xlabel to graph
ylabel('Amplitude'); %adds ylabel to graph
grid; %turns on grid
axis([200,800,-.1,.4]); %defines axis
[x(min),x(max),y(min),y(max)]
Figure 4: FM Signal, Beta = 5 in the time domain.
% Plot of FM Signal in Frequency Domain
[Sf,SfRange] = centeredFFT(st,fs); %Uses centeredFFT
function
freqPlot = figure; %gives graph window a name and
keeps it available
stem(SfRange,Sf); %Creates stem graph for magnitude
spectrum
title('FM Signal (B=5) - 2 Sided Spectrum') %adds
title to graph
xlabel('Freq (Hz)'); %adds xlabel to graph
ylabel('Amplitude'); %adds ylabel to graph
grid; %turns on grid
axis([-1000,1000,-.1,.4]); %defines axis
[x(min),x(max),y(min),y(max)]
Figure 6: FM Signal Beta = 5 in the frequency domain
(close-up). Notice there are many sideband frequencies
making up the message signal thus the higher bandwidth
(Wideband)
4. CTU: EE 443 – Communications 1: Lab 3: MATLAB Project – Frequency Modulation / Detection and Noise 4
% ------- FM Signal with No Carrier
Beta = 1;
Ac = 0; %Carrier is no longer transmitting
st = Ac*sin(2*pi*Fc*t+Beta*sin(2*pi*Fm*t)); %FM
signal
% Plot of FM signal in Time Domain
timePlot = figure; %gives graph window a name and
keeps it available
plot (t,st); %plots FM signal in time domain
title('FM Signal (No carrier) - Time domain'); %adds
title to graph
xlabel('Time (s)'); %adds xlabel to graph
ylabel('Amplitude'); %adds ylabel to graph
grid; %turns on grid
axis([0,40e-3,-2,2]); %defines axis
[x(min),x(max),y(min),y(max)]
Figure 8: FM Signal without a carrier in the frequency
domain. No signals present because no carrier!
% Plot of Modulated Wave in Frequency Domain - Close
Up
freqPlot = figure; %gives graph window a name and
keeps it available
stem(SfRange,Sf); %Creates stem graph for magnitude
spectrum
title('FM Signal (No carrier) - Pos Spectrum
Closeup')
xlabel('Freq (Hz)'); %adds xlabel to graph
ylabel('Amplitude'); %adds ylabel to graph
grid; %turns on grid
axis([0,1000,-.1,.4]); %defines axis
[x(min),x(max),y(min),y(max)]
Figure 7: FM Signal with no carrier (Ac = 0). Without a
carrier you have no FM!
% Plot of FM Signal in Frequency Domain
[Sf,SfRange] = centeredFFT(st,fs); %Uses centeredFFT
function
freqPlot = figure; %gives graph window a name and
keeps it available
stem(SfRange,Sf); %Creates stem graph for magnitude
spectrum
title('FM Signal (No carrier) - 2 Sided Spectrum')
%adds title to graph
xlabel('Freq (Hz)'); %adds xlabel to graph
ylabel('Amplitude'); %adds ylabel to graph
grid; %turns on grid
axis([-1000,1000,-.1,.4]); %defines axis
[x(min),x(max),y(min),y(max)]
Figure 9: FM Signal without a carrier in the frequency
domain (close-up). No signals present because no carrier!
5. CTU: EE 443 – Communications 1: Lab 3: MATLAB Project – Frequency Modulation / Detection and Noise 5
2. Part 2 – FM Modulation and Partial
Demodulation in MATLAB
For the next phase of the lab a new square wave
message signal is now generated in MATLAB using a VCO in
Simulink. The message frequency and carrier were chosen in
such a way as to be easily visible by the scope. The
modulation and settings used in Simulink are illustrated by
the figures below.
Figure 10: Simulink Block Diagram for FM Modulation
Figure 11: Simulink Pulse generator settings for
generating a 100Hz square wave.
6. CTU: EE 443 – Communications 1: Lab 3: MATLAB Project – Frequency Modulation / Detection and Noise 6
Figure 14: The output frequency modulated wave.
Figure 12: VCO settings for Modulating the input signal.
The quiescent frequency is the fc in FM and the Input
sensitivity is the kf in FM. Thus this should adequately
frequency modulate our message onto a 1k Hertz carrier
with a high enough Kf to produce around two to four
sidebands (wideband).
Figure 15: The message square wave in the time domain.
Notice a square wave has many low frequency components
(> 0dB.)
Figure 13: The output square wave in the time domain.
7. CTU: EE 443 – Communications 1: Lab 3: MATLAB Project – Frequency Modulation / Detection and Noise 7
Figure 18: As a result of positive slope detection we
Figure 16: The FM wave in the frequency domain. Notice
receive an FM-AM product. Using a good envelope
there are about four sidebands >0dB representing our FM
detector we could then attempt to demodulate our signal.
wave.
However a good envelope detector is a complex process
and requires several block sets in MATLAB. Another
Now that we have produced a good modulated wave
approach is to use a phase-locked loop which was
the next step is demodulation of the FM wave. The lab demonstrated in another class project.
wished to demonstrate demodulation using a positive and
negative slope detector simulated as transfer functions.
However the next step following slope detection is envelope
detection and an envelope detection module is not common
to the Simulink library so this step could not be completed.
Another approach to demodulation involved a phase-locked
loop system, an easier process to manage in Simulink.
Figure 19: The AM-FM wave in the frequency spectrum.
3. Part 2 – Noise
Figure 17: Partial Demodulation of FM wave using a
positive slope detector circuit in Simulink. The next and final phase of the lab involved creating
and plotting a noise signal in MATLAB in the time and
frequency domain, as well as the autocorrelation function of
that noise. This accomplished with the following code...
% Noise signal
fs = 10000; %sampling frequency
ts = 1/fs; %sampling interval
t = 0:ts:1-ts; %time vector
nt = rand([1,10000]); % returns an n-by-n matrix
containing pseudorandom values
8. CTU: EE 443 – Communications 1: Lab 3: MATLAB Project – Frequency Modulation / Detection and Noise 8
% Plot of noise signal in Time Domain
timePlot = figure; %gives graph window a name and
keeps it available
plot (t,nt); %plots noise in time domain
title('Noise Signal - Time Domain'); %adds title to
graph
xlabel('Time (s)'); %adds xlabel to graph
ylabel('Amplitude'); %adds ylabel to graph
grid; %turns on grid
Figure 21: Noise signal in the frequency domain. Notice
noise is very small (almost 0) at higher frequencies but an
impulse at 0 Hz. This is as expected, which is why a small
resistor can do wonders at eliminating LF noise!
Now the autocorrelation function was found using the
following code...
% Plot of autocorrelation of n(t)
Figure 20: Noise signal in the time domain. Rxx=xcorr(nt); % Estimate its autocorrelation
ACorrPlot = figure;
% Plot of noise signal in Frequency Domain plot(Rxx); % Plot the autocorrelation
[Nf,NfRange] = centeredFFT(nt,fs); %Uses centeredFFT title('Autocorrelation Function of n(t)');
function xlabel('time shift - lags');
freqPlot = figure; %gives graph window a name and ylabel('Autocorrelation');
keeps it available grid; %turns on grid
stem(NfRange,Nf); %Creates stem graph for magnitude
spectrum
title('Noise Signal - 2 Sided Spectrum') %adds title
to graph
xlabel('Freq (Hz)'); %adds xlabel to graph
ylabel('Amplitude'); %adds ylabel to graph
grid; %turns on grid
Figure 22: Autocorrelation function of noise signal.
Finally Simulink was used to insert noise into a
sinusoidal message signal, a low pass filter was used to
eliminate the noise (while varying the noise). Lastly a square
9. CTU: EE 443 – Communications 1: Lab 3: MATLAB Project – Frequency Modulation / Detection and Noise 9
wave message was used and the output was again sent to the
slope detector circuit for analysis. The results follow..
Figure 25: Message signal with large Gaussian noise after
LP filter, notice you can now kind of see the message.
Figure 23: Simulink circuit used for noise simulations.
Figure 26: Message signal with smaller amount of
Gaussian noise after a LP filter stage. Notice the noise is
much less now.
Figure 24: This is a representation of the message signal
with large added Gaussian noise.
10. CTU: EE 443 – Communications 1: Lab 3: MATLAB Project – Frequency Modulation / Detection and Noise 10
Figure 29: After LP filtering out the noise, where is our
signal? This is because a square wave contains many high
frequency components that just got filtered out!
Figure 27: Simulink block diagram used for Pulse
generator (square wave input).
Figure 30: Results of LP filtering our square wave with
less noise added to the signal. Now we are getting
somewhere, however we’ve still lost the form of our square
wave.
Figure 28: Large amount of noise added to square wave.
If you can still call it that.
11. CTU: EE 443 – Communications 1: Lab 3: MATLAB Project – Frequency Modulation / Detection and Noise 11
IV. CONCLUSIONS
The frequency modulation (FM) process was easy to
simulate using MATLAB code. Beta’s influence in the
bandwidth of an FM signal was further reinforced, as well as
the concept of what drives frequency modulation (the
carrier). Without a carrier there is nothing to modulate thus
no FM signal.
The Simulink modeling of an FM wave further
improved my understanding and demonstrated that a slope
detector can be used to create an FM-AM hybrid wave that’s
AM potion can be envelope detected to retrieve a message
signal.
Graphing noise in MATLAB was a breeze and quite
informative. By simulating the noise in Simulink a greater
understanding of the drastic effects of noise on signals and
the important use of specially designed filters. It was finally
observed that noise plays an even greater role on digital
systems such as a square wave which contains several
frequency components. Isolating noise from such a system is
even more difficult due to the increased number of frequency
components (harmonics) making up the message.
This was a satisfying lab and if I had further time I
would have enjoyed fully demodulating the FM wave using an
Figure 31: Simulink block diagram used for simulating additional negative slope detector and two envelope
noise entering an FM modulation scheme. detectors.
REFERENCES
nd
[1] Haykin, S., “Analog and Digital Communications 2
Edition” John Wiley & Sons, Haboken, NJ, 2007.
Figure 32: FM Scheme with added large noise. No longer
looks anything like FM!
12. CTU: EE 443 – Communications 1: Lab 3: MATLAB Project – Frequency Modulation / Detection and Noise 12
function Lab3 = Comm1Lab3() %Function name for calling in MATLAB
% Colorado Technical University
% EE 443 - Communications I
% Lab 3 - MATLAB Project - Frequency Modulation/ Demodulation and Noise
% By Loren K. Schwappach
% Uses centeredFFT() for obtaining a two-sided spectrum
% ---------------------------
% ------- TASK 1
% Generating Carrier, Message and Modulated wave
Fc = 500;
Ac = 2;
Pc = 0;
Fm = 25;
Am = 1;
Pm = 0;
Beta = 0;
fs = 5000; %sampling frequency
ts = 1/fs; %sampling interval
t = 0:ts:((1/Fm)*3); %time vector
m = Am*sin(2*pi*Fm*t + Pm); %message wave
c = Ac*sin(2*pi*Fc*t + Pc); %carrier wave
st = Ac*sin(2*pi*Fc*t+Beta*sin(2*pi*Fm*t)); %FM signal
% ------- B = .1
Beta = .1;
st = Ac*sin(2*pi*Fc*t+Beta*sin(2*pi*Fm*t)); %FM signal
% Plot of FM signal in Time Domain
timePlot = figure; %gives graph window a name and keeps it available
plot (t,st); %plots FM signal in time domain
title('FM Signal (B=.1) - Time domain'); %adds title to graph
xlabel('Time (s)'); %adds xlabel to graph
ylabel('Amplitude'); %adds ylabel to graph
grid; %turns on grid
axis([0,40e-3,-2,2]); %defines axis [x(min),x(max),y(min),y(max)]
% Plot of FM Signal in Frequency Domain
[Sf,SfRange] = centeredFFT(st,fs); %Uses centeredFFT function
freqPlot = figure; %gives graph window a name and keeps it available
stem(SfRange,Sf); %Creates stem graph for magnitude spectrum
title('FM Signal (B=.1) - 2 Sided Spectrum') %adds title to graph
xlabel('Freq (Hz)'); %adds xlabel to graph
ylabel('Amplitude'); %adds ylabel to graph
grid; %turns on grid
axis([-800,800,-.1,.4]); %defines axis [x(min),x(max),y(min),y(max)]
% Plot of Modulated Wave in Frequency Domain - Close Up
freqPlot = figure; %gives graph window a name and keeps it available
stem(SfRange,Sf); %Creates stem graph for magnitude spectrum
title('FM Signal (B=.1) - Pos Spectrum Closeup')
xlabel('Freq (Hz)'); %adds xlabel to graph
ylabel('Amplitude'); %adds ylabel to graph
grid; %turns on grid
axis([400,600,-.1,.4]); %defines axis [x(min),x(max),y(min),y(max)]
% ------- B = 5
Beta = 5;
st = Ac*sin(2*pi*Fc*t+Beta*sin(2*pi*Fm*t)); %FM signal
% Plot of FM signal in Time Domain
timePlot = figure; %gives graph window a name and keeps it available
13. CTU: EE 443 – Communications 1: Lab 3: MATLAB Project – Frequency Modulation / Detection and Noise 13
plot (t,st); %plots FM signal in time domain
title('FM Signal (B=5) - Time domain'); %adds title to graph
xlabel('Time (s)'); %adds xlabel to graph
ylabel('Amplitude'); %adds ylabel to graph
grid; %turns on grid
axis([0,40e-3,-2,2]); %defines axis [x(min),x(max),y(min),y(max)]
% Plot of FM Signal in Frequency Domain
[Sf,SfRange] = centeredFFT(st,fs); %Uses centeredFFT function
freqPlot = figure; %gives graph window a name and keeps it available
stem(SfRange,Sf); %Creates stem graph for magnitude spectrum
title('FM Signal (B=5) - 2 Sided Spectrum') %adds title to graph
xlabel('Freq (Hz)'); %adds xlabel to graph
ylabel('Amplitude'); %adds ylabel to graph
grid; %turns on grid
axis([-1000,1000,-.1,.4]); %defines axis [x(min),x(max),y(min),y(max)]
% Plot of Modulated Wave in Frequency Domain - Close Up
freqPlot = figure; %gives graph window a name and keeps it available
stem(SfRange,Sf); %Creates stem graph for magnitude spectrum
title('FM Signal (B=5) - Pos Spectrum Closeup')
xlabel('Freq (Hz)'); %adds xlabel to graph
ylabel('Amplitude'); %adds ylabel to graph
grid; %turns on grid
axis([200,800,-.1,.4]); %defines axis [x(min),x(max),y(min),y(max)]
% ------- FM Signal with No Carrier
Beta = 1;
Ac = 0; %Carrier is no longer transmitting
st = Ac*sin(2*pi*Fc*t+Beta*sin(2*pi*Fm*t)); %FM signal
% Plot of FM signal in Time Domain
timePlot = figure; %gives graph window a name and keeps it available
plot (t,st); %plots FM signal in time domain
title('FM Signal (No carrier) - Time domain'); %adds title to graph
xlabel('Time (s)'); %adds xlabel to graph
ylabel('Amplitude'); %adds ylabel to graph
grid; %turns on grid
axis([0,40e-3,-2,2]); %defines axis [x(min),x(max),y(min),y(max)]
% Plot of FM Signal in Frequency Domain
[Sf,SfRange] = centeredFFT(st,fs); %Uses centeredFFT function
freqPlot = figure; %gives graph window a name and keeps it available
stem(SfRange,Sf); %Creates stem graph for magnitude spectrum
title('FM Signal (No carrier) - 2 Sided Spectrum') %adds title to graph
xlabel('Freq (Hz)'); %adds xlabel to graph
ylabel('Amplitude'); %adds ylabel to graph
grid; %turns on grid
axis([-1000,1000,-.1,.4]); %defines axis [x(min),x(max),y(min),y(max)]
% Plot of Modulated Wave in Frequency Domain - Close Up
freqPlot = figure; %gives graph window a name and keeps it available
stem(SfRange,Sf); %Creates stem graph for magnitude spectrum
title('FM Signal (No carrier) - Pos Spectrum Closeup')
xlabel('Freq (Hz)'); %adds xlabel to graph
ylabel('Amplitude'); %adds ylabel to graph
grid; %turns on grid
axis([0,1000,-.1,.4]); %defines axis [x(min),x(max),y(min),y(max)]
% ------- End of Task 1
14. CTU: EE 443 – Communications 1: Lab 3: MATLAB Project – Frequency Modulation / Detection and Noise 14
% ---------------------------------------------
% ------- Task 2 is done with Simulink
% ---------------------------------------------
% ------- TASK 3
% Noise signal
fs = 10000; %sampling frequency
ts = 1/fs; %sampling interval
t = 0:ts:1-ts; %time vector
nt = rand([1,10000]); % returns an n-by-n matrix containing pseudorandom values
% Plot of noise signal in Time Domain
timePlot = figure; %gives graph window a name and keeps it available
plot (t,nt); %plots noise in time domain
title('Noise Signal - Time Domain'); %adds title to graph
xlabel('Time (s)'); %adds xlabel to graph
ylabel('Amplitude'); %adds ylabel to graph
grid; %turns on grid
% Plot of noise signal in Frequency Domain
[Nf,NfRange] = centeredFFT(nt,fs); %Uses centeredFFT function
freqPlot = figure; %gives graph window a name and keeps it available
stem(NfRange,Nf); %Creates stem graph for magnitude spectrum
title('Noise Signal - 2 Sided Spectrum') %adds title to graph
xlabel('Freq (Hz)'); %adds xlabel to graph
ylabel('Amplitude'); %adds ylabel to graph
grid; %turns on grid
% Plot of autocorrelation of n(t)
Rxx=xcorr(nt); % Estimate its autocorrelation
ACorrPlot = figure;
plot(Rxx); % Plot the autocorrelation
title('Autocorrelation Function of n(t)');
xlabel('time shift - lags');
ylabel('Autocorrelation');
grid; %turns on grid
% ------- End of Task 3 MATLAB code portion
% ---------------------------------------------
% end Comm1Lab3