Communication PDF
Communication PDF
Communication Systems
Updated by:
Engr.Onaiza Yousaf
Revised On:
16th March, 2015
Contents
Lab 1.........................................................................................................................3
Introduction to MALTAB ........................................................................................3
Lab 2.......................................................................................................................16
Introduction to Basic Signals and Signal Operations...........................................16
Lab 3.......................................................................................................................24
Fourier series, magnitude and phase calculation on Matlab ...............................24
Lab 4.......................................................................................................................33
Signal Correlation................................................................................................33
Lab 5.......................................................................................................................41
Fourier series, magnitude and phase calculation on Matlab ...............................41
Lab 6.......................................................................................................................50
Evaluation ...........................................................................................................50
Lab 7.......................................................................................................................51
Computing Fourier Transforms ...........................................................................51
Lab 8 .......................................................................................................................56
Calculation of Essential Bandwidth .....................................................................56
Lab 9.......................................................................................................................60
To design and implement the AM Modulator by balanced modulator using Matlab
............................................................................................................................60
Lab 10.....................................................................................................................63
To demodulate a modulated AM signal using Matlab..........................................63
Lab 11.....................................................................................................................66
Implement a modulation and demodulation of signal using DSB SC ..................66
Lab 12.....................................................................................................................73
Implement a modulation and demodulation of signal using SSB SC ..................73
Lab 13.....................................................................................................................76
Implement a modulation and demodulation of signal using frequency Modulation
............................................................................................................................76
Lab 14.....................................................................................................................78
Study the multiplexing and digital modulation techniques ...................................78
Lab 15 & 16 ............................................................................................................81
Study thedifferent digital modulation techniques .................................................81
Lab 1
Introduction to MALTAB
Objective:
To become familiar with the use of some basic operations such as addition,
subtraction, multiplication, division and some basic commands like eye, zeros,
ones, plot and stem.
Introduction:
What Is MATLAB?
MATLAB is a high-performance language for technical computing. It
integrates computation, visualization, and programming in an easy-to-use
environment where problems and solutions are expressed in familiar
mathematical notation. Typical uses include
MATLAB has evolved over a period of years with input from many users. In
university environments, it is the standard instructional tool for introductory
and advanced courses in mathematics, engineering, and science. In industry,
MATLAB is the tool of choice for high-productivity research, development,
and analysis.
Matrix computations
Vector Analysis
Differential Equations computations
Integration is possible
Computer language programming
Simulation
Graph Plotation
2-D & 3-D Plotting
Benefits:
Some Benefits of MATLAB are given as follows:
Simple to use
Fast computations are possible
Wide working range
Solution of matrix of any order
Desired operations are performed in matrices
Different Programming languages can be used
Simulation is possible
Basic Commands:
Some basic MATLAB commands are given as follows:
A) Operators
MATLAB provides several arithmetic and logical operators, some of which
are as follows. For a complete list, MATLABs help manual should be
consulted.
==
equality
+
*
.*
^
.^
/
./
<>
|
~
addition
subtraction or minus
multiplication
array multiplication
power
array power
division
array division
relational operators & logical AND
logical OR
logical NOT
transpose
array transpose
Addition:
A+B
Example:
Subtraction:
A-B
Example:
Multiplication:
A*B>> Matrix Multiplication
A.*B >>Element-wise Multiplication
Example:
Division:
A/B>> Matrix Division
A./B>>Element-wise Division
Example:
Power:
A^B
A.^B>> Power of each element individually
Example:
B) Numbers
MATLAB is a high-precision numerical engine and can handle all types of
numbers, that is, integers, real numbers, complex numbers, among others, with
relative ease. For example, the real number 1.23 is represented as simply 1.23
while the real number 4.56 10^7 can be written as 4.56e7. The imaginary
number is denoted either by 1i or 1j. Hence the complex number whose real
part is 5 and whose imaginary part is 3 will be written as 5+1j*3. Other
constants preassigned by MATLAB are pi for , inf for , and NaN for not a
number (for example, 0/0). These preassigned constants are very important
and, to avoid confusion, should not be redefined by users.
Example:
C) Variables
In MATLAB, which stands for MATrixLABoratory, the basic variable is a
matrix, or an array. Hence, when MATLAB operates on this variable, it
operates on all its elements. This is whatmakes it a powerful and an efficient
engine. Now test the following assignments and chose an appropriate answer.
This explains available matrix types in MATLAB:
>> a = [3]
a. Scalar
b. Row Vector
c. Column Vector
d. Matrix
>>x = [1,2,3]
a. Scalar
b. Row Vector
c. Column Vector
d. Matrix
>>y = [1;2;3]
a. Scalar
b. Row Vector
c. Column Vector
d. Matrix
>>A = [1,2,3;4,5,6]
a. Scalar
b. Row Vector
c. Column Vector
d. Matrix
MATLAB provides many useful functions to create special matrices. These include
zeros(M,N) for creating a matrix of all zeros, ones(M,N) for creating matrix of all
ones, eye(N) for creating an N N identity matrix, etc. Consult MATLABs help
manual and give two examples for each:
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Exercise # 1
Generate and plot of the following functions with four panels.
(a)
(b)
(c)
(d)
CODE:
FIGURE:
Short Questions:
1) What is the difference between plot and stem?
2)
A=[1:2:3];
3)
and
Find an error.
Assignment:
Question:
A=[1:2:3]
Lab 2
Introduction to Basic Signals and Signal
Operations
Objective:
To become familiar with the use of some basic signals (unit step
and delta) and signal operations such as time scaling, time shifting, inversion
or folding.
Soft ware Used:
MATLAB
Introduction:
Discrete time signals are defined only at certain specific values of time. They
can be represented by x[n] where n is integer valued and represents discrete
instances in time. i.e:
X[n] = {., x[-1], x[0] ,x[1] ,..}
Where the up-arrow indicates the sample at n=0.
In MATLAB, we can represent a finite-duration sequence like above by a row
of vector of appropriate values. However such a vector does not have any
information about sample position n. therefore a correct representation of x[n]
would require two vectors, one each for x and n. for example a signal
X[n] = {2,1,-1,0,1,4,3}
>>n=[-3,-2,-1,0,1,2,3];
>>x=[2,1,-1,0,1,4,3];
An arbitrary infinite duration signal cannot be represented by MATLAB
due to finite memory limitations.
Delta Function
Delta Function:
if t<0
if t>0
function y=ustep(t)
y=(t>=0)
end
__________________________________________________________________________
__
if t>0
if t<0
if t=0
function y=impulse(t)
y=(t==0);
end
Exercise:
(1)Use above function to plot unit step sequence having range between 1 and
15.
CODE:
t=1:15;
x=ustep(t);
stem(t,x)
GRAPH:
(2)Use above function to plot unit step sequence having range between 1 to 15,
shifted at n=-3.
CODE:
t=1:15;
x=ustep(t-3);
stem(t,x)
GRAPH:
(3) Use above function to plot unit sample sequence that has a value at n=0.
(4) Use above function to plot unit sample sequence that has a value at n=3.
SIGNAL OPERATIONS:
a.Shifting
b.Scaling
c.Time Inversion
(1)Apply time shifting ,time scaling and time inversion to the following signal.
x(t)=exp(-|t|/4)[u(t)-u(t-4)]
Time Shifting:
x1(t)=x(t+2)
CODE:
t=-5:5;
x=exp(-abs(t)./4).*(ustep(t)-ustep(t-4));
subplot(221);
axis([-3 5 -.5 1.5]);
plot(t,x);
grid on;
title('original signal')
xlabel('t');
ylabel('x(t)');
Time Scaling:
x2(t)=x(2t)
Time Inversion
x3(t)=x(2-2t)
%Time Shifting:
x1(t)=x(t+2)
t1=t+2;
x1=exp(-abs(t1)./4).*(ustep(t1)-ustep(t1-4));
subplot(222);
axis([-3 5 -.5 1.5]);
plot(t,x1);
grid on;
title('shifted signal')
xlabel('t');
ylabel('x(t1)');
% Time Scaling:
x2(t)=x(2t)
t2=t.*2;
x2=exp(-abs(t2)./4).*(ustep(t2)-ustep(t2-4));
subplot(223);
axis([-3 5 -.5 1.5]);
plot(t,x2);
grid on;
title('scaled signal')
xlabel('t');
ylabel('x(t2)');
% Time Inversion:
x3(t)=x(2-2t)
t3=2-t*2;
x3=exp(-abs(t3)./4).*(ustep(t3)-ustep(t3-4));
subplot(224);
axis([-3 5 -.5 1.5]);
plot(t,x3);
grid on;
title('inverted signal')
xlabel('t');
ylabel('x(t3)');
GRAPH:
Questions:
Q#1: For the signal
Lab 3
Fourier series, magnitude and phase
calculation on Matlab
Objective:
To become familiar with the use of some basic signals (unit step)
and computing the coefficient of Fourier series and also plot the magnitude
and phase spectra.
Soft ware Used:
MATLAB
Introduction:
Transforms are used extensively in engineering to change the frame of
reference between the time domain and the frequency domain. Many
techniques exist for analyzing steady-state and smoothly changing systems in
the time domain, but complex systems often can be more easily analyzed in
other domains.
Fourier series and the Fourier transform play a vital role in many areas of
engineering such as communications and signal processing. These
representations are among the most powerful and most common methods of
analyzing and understanding signals. A solid understanding of Fourier series
and the Fourier transform is critical to the design of filters and is beneficial in
developing the understanding of many natural phenomena.
Almost all periodic signals can be represented as an infinite sum of sine and
cosines. This sum is called a Fourier series representation and is defined for a
periodic function
of period T with the following equation.
(
cos
sin
Where a0, an and bn are the Fourier series coefficients. These coefficients can be calculated
by applying the following equations:
cos
t an
sin
where
Delta Function
Delta Function:
%ustep(t)=0
%ustep(t)=1
if t<0
if t>0
function y=ustep(t)
y=(t>=0)
end
__________________________________________________________________________
__
if t>0
if t<0
if t=0
function y=impulse(t)
y=(t==0);
end
Exercise:
(1)Use above function to plot unit step sequence having range between 1 and
15.
CODE:
t=1:15;
x=ustep(t);
stem(t,x)
GRAPH:
(2)Use above function to plot unit step sequence having range between 1 to 15,
shifted at n=-3.
CODE:
t=1:15;
x=ustep(t-3);
stem(t,x)
GRAPH:
(3) Use above function to plot unit sample sequence that has a value at n=0.
(4) Use above function to plot unit sample sequence that has a value at n=3.
GRAPH:
CODE:
Fourier series of Saw Tooth Wave
Plot of saw tooth wave
In this section we take an arbitrary saw tooth wave and plot it. Next we plot the magnitude
and phase of the Fourier co-efficient. Then reconstruct the saw tooth wave by combining
various harmonics.
x = [0.1 0.9 0.1];
x = [x x x x];
tx = [-2 -1 0 0 1 2 2 3 4 4 5 6];
plot (tx , x );
grid;
xlabel('Time (sec)');
ylabel('Amplitude ');
title ('Periodic Signal x(t)');
axis ([-2 6 0 1]);
% 1 period of x(t)
% 4 periods of x(t)
% time points for x(t)
Figure 1
Code:
Magnitude and Phase Plot
a0 = 0.5;
% DC component of Fourier series
ph0 = 0;
n = [1 3 5 7 9];
% value of n to be evaluated
an = -pi./ ( pi * n ) .^2 ;
% Fourier Series C officients
mag_an = abs (an);
phase_an = -180 * ones (1, length (n));
n = (n);
mag_an = [mag_an];
% including a0 with a_n;
phase_an = [phase_an];
figure (2);
clf;
subplot (2, 1 , 1);
plot (n, mag_an, 'o');
grid;
xlabel('Harmonic Number');
ylabel ('Magnitude');
title (' Fourier Series Magnitude ');
axis ( [ 0 10 0 0.6 ] );
subplot ( 2 , 1, 2);
plot (n,phase_an, 'o');
grid;
xlabel( 'Harmonic Number');
ylabel ('Phase (radians)');
title ('Fourier Series Phase ');
Graph:
Questions:
Q#1:Find the strength of a given signal
Lab 4
Signal Correlation
Objective:
To become familiar with the use of some basic signals (unit step
and delta) and square root of energies and correlation coefficients.
Soft ware Used:
MATLAB
Introduction:
Correlation is an important concept that is used to
determine the degree of similarity between two signals. The value of
correlation coefficient lies between -1 to 1.
Formula:
If we have two signals
and we want to find the
similarity between these two signals. Correlation coefficient determines the
degree of similarity in between them. Formula is given below.
Delta Function
Delta Function:
if t<0
if t>0
function y=ustep(t)
y=(t>=0)
end
__________________________________________________________________________
__
if t>0
if t<0
if t=0
function y=impulse(t)
y=(t==0);
end
Exercise:
(1)Use above function to plot unit step sequence having range between 1 and
15.
CODE:
t=1:15;
x=ustep(t);
stem(t,x)
GRAPH:
(2)Use above function to plot unit step sequence having range between 1 to 15,
shifted at n=-3.
CODE:
t=1:15;
x=ustep(t-3);
stem(t,x)
GRAPH:
(3) Use above function to plot unit sample sequence that has a value at n=0.
(4) Use above function to plot unit sample sequence that has a value at n=3.
SIGNAL Correlation:
CODE:
clc
t=[-1:0.01:6];
x=sin(2*pi*t);
g1=sin(2*pi*t).*[0.707*(ustep(t)-ustep(t-1))];
g2=sin(t).*[0.707*(ustep(t))];
subplot(131);
plot(t,x);
xlabel('t');
ylabel('x(t)');
axis([0 1 -1 1]);
grid
subplot(132);
plot(t,g1);
xlabel('t');
ylabel('g1(t)');
axis([0 1 -1 1]);
grid
subplot(133);
plot(t,g2);
xlabel('t');
ylabel('g2(t)');
axis([0 6 -1 1]);
grid
e0=sum(x.*conj(x))*0.01;
e1=sum(g1.*conj(x))*0.01;
e2=sum(g2.*conj(x))*0.01;
p0=sum(x.*conj(x))*0.01/(sqrt(e0*e0))
p1=sum(x.*conj(g1))*0.01/(sqrt(e0*e1))
p2=sum(x.*conj(g2))*0.01/(sqrt(e0*e2))
GRAPH:
Questions:
Q#1: For the signal
these signals.
and
Lab 5
Fourier series, magnitude and phase
calculation on Matlab
Objective:
To become familiar with the use of some basic signals (unit step)
and computing the coefficient of Fourier series and also plot the magnitude
and phase spectra.
Soft ware Used:
MATLAB
Introduction:
Transforms are used extensively in engineering to change the frame of
reference between the time domain and the frequency domain. Many
techniques exist for analyzing steady-state and smoothly changing systems in
the time domain, but complex systems often can be more easily analyzed in
other domains.
Fourier series and the Fourier transform play a vital role in many areas of
engineering such as communications and signal processing. These
representations are among the most powerful and most common methods of
analyzing and understanding signals. A solid understanding of Fourier series
and the Fourier transform is critical to the design of filters and is beneficial in
developing the understanding of many natural phenomena.
Almost all periodic signals can be represented as an infinite sum of sine and
cosines. This sum is called a Fourier series representation and is defined for a
periodic function
of period T with the following equation.
cos
sin
Where a0, an and bn are the Fourier series coefficients. These coefficients can be calculated
by applying the following equations:
cos
t an
sin
where
Delta Function
Delta Function:
if t<0
if t>0
function y=ustep(t)
y=(t>=0)
end
__________________________________________________________________________
__
if t>0
if t<0
if t=0
function y=impulse(t)
y=(t==0);
end
Exercise:
(1)Use above function to plot unit step sequence having range between 1 and
15.
CODE:
t=1:15;
x=ustep(t);
stem(t,x)
GRAPH:
(2)Use above function to plot unit step sequence having range between 1 to 15,
shifted at n=-3.
CODE:
t=1:15;
x=ustep(t-3);
stem(t,x)
GRAPH:
(3) Use above function to plot unit sample sequence that has a value at n=0.
(4) Use above function to plot unit sample sequence that has a value at n=3.
CODE:
Fourier series of Saw Tooth Wave
Plot of saw tooth wave
In this section we take an arbitrary saw tooth wave and plot it. Next we plot the magnitude
and phase of the Fourier co-efficient. Then reconstruct the saw tooth wave by combining
various harmonics.
x = [0.1 0.9 0.1];
x = [x x x x];
tx = [-2 -1 0 0 1 2 2 3 4 4 5 6];
plot (tx , x );
grid;
xlabel('Time (sec)');
ylabel('Amplitude ');
title ('Periodic Signal x(t)');
axis ([-2 6 0 1]);
% 1 period of x(t)
% 4 periods of x(t)
% time points for x(t)
Figure 1
Code:
Magnitude and Phase Plot
a0 = 0.5;
% DC component of Fourier series
ph0 = 0;
n = [1 3 5 7 9];
% value of n to be evaluated
an = -pi./ ( pi * n ) .^2 ;
% Fourier Series C officients
mag_an = abs (an);
phase_an = -180 * ones (1, length (n));
n = (n);
mag_an = [mag_an];
% including a0 with a_n;
phase_an = [phase_an];
figure (2);
clf;
subplot (2, 1 , 1);
plot (n, mag_an, 'o');
grid;
xlabel('Harmonic Number');
ylabel ('Magnitude');
title (' Fourier Series Magnitude ');
axis ( [ 0 10 0 0.6 ] );
subplot ( 2 , 1, 2);
plot (n,phase_an, 'o');
grid;
xlabel( 'Harmonic Number');
ylabel ('Phase (radians)');
title ('Fourier Series Phase ');
Graph:
Questions:
Q#1:Find the strength of a given signal
Lab 6
Evaluation
Pre-Lab:
Lab Manual 1 to 5
Questions:
(1) Apply time shifting, time scaling and time inversion to the following signal.
x(t)=exp(-|t|/4)[u(t)-u(t+4)]
Time Shifting:
x1(t)=x(t+2)
Time Scaling:
x2(t)=x(2t)
Time Inversion
x3(t)=x(2-2t)
(2) Find the signal energy and convert this energy signal to a power signal.
x(t)=exp(-|t|/4)[u(t)-u(t+4)]
Lab 7
Computing Fourier Transforms
Objective:
To become familiar with the use of fft n cart2pol commands.
Pre-Lab:
Chapter #3 of B.P.Lathi
Introduction:
Use DFT(implementation by theft algorithm) to compute the
fourier transform of
.Plot the resulting fourier spectra.
We first determine the
and
) is
this low pas signal is not band limited. Let us take its essential bandwidth to be
| become 1% of its peak value at
the frequency where |
.Obsevere
that
is at
is 0.5.Hence the essential
,where
B= Hz
Code:
GRAPH:
Question:
Find the fourier transform of
).
Lab 8
Calculation of Essential Bandwidth
Pre-Lab:
Chapter #3 of B.P.Lathi
Introduction:
Code:
function[p]=sink(x)
p=((sin(x./2))./(x./2)).^2
for b=0:.1:2
ti=1
x=2*pi.*b*ti
qd=quad(@sink,0,x);
ans=(qd./pi)
hold on
plot(b,ans)
xlabel('values of b')
ylabel('values of Eb/Eg=ans')
title('essentail bandwidth')
end
GRAPH:
Description:
It is rectangular pulse
1st calculate its energy that is ti gives it some numeric value as 1
Fourier transform of rect is sinc function
Convert the sinc into sin as sinc=sin(x)/x
Set the limits of sin function from 0 to x=2bti
Integrate this function by calling the sin function
Divide the answer of integration by
Ans=Eb/Eg
Hold on command is used to show all the values of b that is for loop
Essential band width contain 90% energy
Bandwidth of rect pulse is 1/ti Hz
It is shown as 0.9 on graph
Question:
Estimate the essential bandwidth W (in rads/s) of the
signal
signal energy.
Lab 9
To design and implement the AM Modulator
by balanced modulator using Matlab
Pre-Lab:
Chapter #4 of B.P.Lathi
Soft ware Used:
MATLAB 2009b
Introduction:
In amplitude Modulation (AM), we utilize the audio signal to modulate the amplitude
of the carrier signal, which means that the amplitude of the carrier signal will be
varied with the amplitude of the audio signal. The waveform of AM modulation is
shown here
(1)
m Am / ADC
ADC DC Signal Amplitude
Am Audio signal amplitude
AC Carrier signal amplitude
f m Audio signal frequency
f c Carrier signal frequency
From
equation
(1)
ADC to control the level or depth of the carrier signal. Therefore this parameter m
is known as modulation index.
X AM
1
ADC m{cos[2 ( f c f m )t ] cos[2 ( f c f m )t ]} ADC AC cos(2f m t )
2
(2)
The first term represents double sideband signals, the second term represents the
carrier signal. From equation (2) we can sketch the frequency spectrum of
amplitude modulation as shown in fig. 3. Since the audio signal is hidden in the
double sidebands and the carrier signal does not contain any message therefore
the power is consumed in the carrier during the transmission of amplitude
modulation signal. For this reason the transmission efficiency of AM modulation is
lower than double sidebands suppressed carrier (DSB-SC) modulation but its
demodulation circuit is much more simple.
Am
100%
ADC
(3)
Generally the magnitude of DC signal is not easy to measure: therefore we
express the modulation index in another form
Emax Emin
100%
Emax Emin
Emin AC Am .
(4)
Emax AC Am and
We know that at amplitude modulation the audio signal is hidden in the double
sidebands, so if the double sidebands signals are getting stronger, the
transmission efficiency is getting better. From equation 2 we know that the double
sideband signals are proportional to the modulation index. Thus the larger the
modulation index the better the transmission efficiency.
Normally modulation index is smaller or equal to 1. If greater than 1 we call it overmodulation as shown in figure 3. From that figure we can see that the variation of
the carrier signal is no longer a sinusoidal wave, it is rather a distorted sinusoidal
wave, therefore this kind of signal is unable to demodulate and recover to original
signal by using the envelop detection.
MATLAB CODE
clc;
clear all;
close all;
Ac=2; %carrier amplitude
fc=0.5; %carrier frequency
Am=.5; %message signal amplitude
fm=.05; %message signal frequency
Fs=100; %sampling rate/frequency
ka=1; %modulation coefficient
t=[0:0.1:50]; %defining the time range & disseminating it into samples
ct=Ac*cos(2*pi*fc*t); %defining the carrier signal wave
mt=Am*cos(2*pi*fm*t); %defining the message signal
AM=ct.*(1+ka*mt); %Amplitude Modulated wave, according to the standard
definition
subplot(3,1,1); %plotting the message signal wave
plot(mt);
ylabel('Message signal');
subplot(3,1,2); %plotting the carrier signal wave
plot(ct);
ylabel('carrier');
subplot(3,1,3); %plotting the amplitude modulated wave
plot(AM);
ylabel('AM signal');
Exercise
1. Define AM and draw its spectrum?
2. Define modulation index?
3. Now modify modulation index and show over-modulation in graph.
4. What are different degrees of modulation?
Lab 10
To demodulate a modulated AM signal
using Matlab
Pre-Lab:
Chapter #4 of B.P.Lathi
Soft ware Used:
MATLAB 2009b
Introduction:
The AM demodulator can be implemented by utilizing a balanced modulator. We
call this type of modulator as synchronous detector or product detector. Figure 2.4
is the block diagram of product detector. In figure 2.4 we notice that the design of
product detector is to multiply the modulated AM signal by synchronized carrier
signal in AM modulator.
Let X AM (t ) be the modulated be the modulated AM signal, X c (t ) be the carrier
signal, i.e.:
X c (t ) Ac cos(2f c t )
(2.2)
When these two signals input two different ports of balanced modulator then the
output signal of the balanced modulator is as follow
xout (t ) kxc (t ) x AM (t )
kA A
kA A
kA A
= DC c DC c m cos(2f mt ) DC c [1 m cos(2f mt )] cos[2(2f ct )
2
2
2
(2.3)
Where k represents the gain of the balanced modulator. In equation (2.3) the first
term is the DC signal, second term is the audio signal and third term is the second
harmonic of modulated AM signal. If we take out the second term by using the low
pass filter as shown in fig. 2.4 then we can obtain the exact demodulated AM signal
or audio signal.
kA A
xout (t ) DC c m cos(2f mt )
2
(2.4)
Equation (2.4) representsthe audio signal or in other words the original modulated
signal can be taken out by product detector.
MATLAB CODE
Fs = 44100;
T = 1;
Fc = 15000;
Fm = 10;
% Low-pass filter design
[num,den] = butter(10,1.2*Fc/Fs);
% Signals
t = 0:1/Fs:T;
x = cos(2*pi*Fm*t);
y = ammod(x,Fc,Fs);
z = amdemod(y,Fc,Fs);
w = amdemod(y,Fc,Fs,0,0,num,den);
% Plot
figure('Name','AM Modulation');
subplot(4,1,1); plot(t,x); title('Modulating signal');
subplot(4,1,2); plot(t,y); title('Modulated signal');
subplot(4,1,3); plot(t,z); title('Demodulated signal');
subplot(4,1,4); plot(t,w); title('Demodulated signal (filtered)');
Results
Exercise
1. Generate a carrier of 25KHz and Modulating signal of 5 KHz
1. First modulate and
2. Then demodulate a signal
Lab 11
Implement a modulation and demodulation
of signal using DSB SC
Pre-Lab:
Chapter #4 of B.P.Lathi
Soft ware Used:
MATLAB 2009b
Introduction:
The DSB-SC modulator output follows eqn. as given next.
The coherent DSB-SC requires a synchronized local oscillator and works on following
principle. Please refer to eqn
A low pass filter filters out the message signal from above.
The SIMULINK implementation is first shownforsinusoidalmodulatingsignalandthen for
a composite signal made up of two sinusoids. Next it is shown how an AM signal (DSBC) with modulation index 1.2 is recovered through coherent detection. Please refer to
result of mini-project on Amplitude Modulation Demodulation using SIMULINK model
for comparison. Finally, using spectrumscope frequency domain representation of
modulated and demodulated signal is seen andcompared. It is seen that for modulated
signal information is available around carrierfrequency while for demodulated signal in
baseband only.
The following shows time scope output for 10 second simulation, original and expanded
time axis.
The following shows preparation of model for composite signal and its performance.
The following shows DSB-C coherent detection for modulation index 1.2. Please refer to
mini-project on Amplitude Modulation Demodulation for comparison.
The following shows use of spectrum scope, its parameterization and display. The input
of bottomscope is output port of filter block which is renamed. Else this by default
shows Ch1 as legend. The modulating signal frequency is made 3000Hz for better
visualization.
Note that the range 0.5 MHz in frequency axis refers to Fs/2 = 100000/2 = 50000 Hz.
EXERSCISE
1. What is difference between Am with Large carrier and DSB SC communication.
2. Do both have same demodulation techniques.
Lab 12
Implement a modulation and demodulation of
signal using SSB SC
Pre-Lab:
Chapter #4 of B.P.Lathi
Soft ware Used:
MATLAB 2009b
Introduction:
%Single SideBand Modulation
%By Naveed Ahmad Chughtai
N = 1024;
fs = 2048;
ts = 1/fs;
%t = (0:ts:1);
t=(0:N-1)/fs;
fc = 600; %Carrier frequency !! Limit fc<800 to avoid freqdomain aliasing
fm1 = 200;
Em1 = 1;
m = Em1*cos(2*pi*fm1*t); %Message
mh = Em1*cos((2*pi*fm1*t)-pi/2); %Hilbert transform of the message signal
Demodulation
md=sbu.*cos(2*pi*fc*t);
[b,a]=butter(2,0.1);
mf=filter(b,a,md);
figure(3)
plot(t,mf)
title('Demodulated Signal');
xlabel('Time'); ylabel('Demodulated Signal');
figure(1);
plot(t,m);
title('Time Domain Representation of Orignal Signal');
xlabel('Time'); ylabel('Original Signal');
EXERSCISE
1. What is difference between Am with Large carrier and SSB SC communication.
2. Do both have same demodulation techniques.
Lab 13
Implement a modulation and demodulation of
signal using frequency Modulation
Pre-Lab:
Chapter #5 of B.P.Lathi
Soft ware Used:
MATLAB 2009b
Matlab code
Modulation
%fm=35HZ,fc=500HZ,Am=1V,Ac=1V,B=10
fs=10000;
Ac=1;
Am=1;
fm=35;
fc=500;
B=10;
t=(0:.1*fs)/fs;
wc=2*pi*fc;
wm=2*pi*fm;
m_t=Am*cos(wm*t);
subplot(3,1,1);
plot(t,m_t);
title('Modulating or Message signal(fm=35Hz)');
c_t=Ac*cos(wc*t);
subplot(3,1,2); plot(t,c_t);
title('Carrier signal(fm=500Hz)');
s_t=Ac*cos((wc*t)+B*sin(wm*t));
subplot(3,1,3);
plot(t,s_t);
title('Modulated signal');
Demodulation
d=demod(s_t,fm,fc,'fm');
Subplot(5,1,4);
plot(t,d);
title('demodulated signal')
EXERSCISE
1.
2.
3.
4.
5.
6.
7.
Lab 14
Study the multiplexing and digital modulation
techniques
Pre-Lab:
Chapter #5 of B.P.Lathi
Soft ware Used:
MATLAB 2009b
Matlab code
FREQUENCY DIVISION MULTIPLEXING
Frequency division multiplexing is another type for multiplexing and is defined as
Frequency-division multiplexing (FDM) is a type of multiplexing in which
numerous signals are combined for transmission on a single communications
line or channel. Each signal is assigned a different frequency ( sub channel)
within the main channel.
Frequency division multiplexing (FDM) is the process by which the total bandwidth
available to the system is divided into a series of non overlapping frequency sub-bands
that are then assigned to each communicating source and user pair.
In the current milieu FDM has become obsolete as modern communication systems
employ
digital transmissions in which time division multiplexing is used.
WORKING OF FDM
Frequency Division Multiplexing (FDM) works by transmitting all of the signals along the same high
speed link simultaneously with each signal set at a different frequency. For FDM to work properly
frequency overlap must be avoided. Therefore, the link must have sufficient bandwidth to be able to
carry the wide range of frequencies required. The demultiplexor at the receiving end works by
dividing the signals by tuning into the appropriate frequency.
FDM operates in a similar way to radio broadcasting where a number of different stations will
broadcast simultaneously but on different frequencies. Listeners can then "tune" their radio so that
it captures the frequency or station they want.
FDM gives a total bandwidth greater than the combined bandwidth of the signals to be transmitted.
In order to prevent signal overlap there are strips of frequency that separate the signals. These are
called guard bands.
x1=0.4*cos(2*pi*f1*t)+0.5;
%modulation
y1=modulate(x1,fc,fs,'pwm');
subplot(311);
plot(x1);
axis([0 50 0 1]);
title('original signal taken mesage,f1=500,fs=10000')
subplot(312);
plot(y1);
axis([0 500 -0.2 1.2]);
title('PWM')
EXERSCISE
1. Define PWM?
2. What do you infer from the frequency spectrum of a PWM signal?
3. What is other name for PWM?
4. What are the disadvantages of PWM?
5. Will PWM work if the synchronization between Tx and Rx fails?
Lab 15 & 16
Study the different digital modulation
techniques
Pre-Lab:
Chapter #6 of B.P.Lathi
Soft ware Used:
MATLAB 2009b
Matlab code
Pulse Amplitude Modulation
a = input('Enter the amplitude = ');
f = input('Enter the frequency = ');
t = 0:0.02:2; % for a total of 20 samples
x1 = stem(t); %generation of impulse signal
x2 = sin(2*pi*f*t); %generation of sine wave
y = x1.*x2; %modulation step
subplot(3,1,1); %for impulse signal plot
stem(x1);
title('Impulse Signal');
xlabel('Time');
ylabel('Amplitude ');
subplot(3,1,2) %for sine wave plot
plot(t,x2);
title('Sine Wave');
xlabel('Time ');
ylabel('Amplitude ');
subplot(3,1,3) %for PAM wave plot
stem(t,y);
title('PAM Wave');
xlabel('Time');
ylabel('Amplitude');
Delta Modulation
t=[0:0.01:1]
m=sinc(2*pi*t)
subplot(211)
hold on
plot(m,'black')
title('sinc pulse')
xlabel('time')
ylabel('amplitude')
d=2*pi/100
for n=1:1:100
if n==1
e(n)=m(n)
eq(n)=d*sign(e(n))
mq(n)=eq(n)
else
e(n)=m(n)-mq(n-1)
eq(n)=d*sign(e(n))
mq(n)=mq(n-1)+eq(n)
end
end
stairs(mq,'red')
hleg=legend('original signal','stair case approximated signal')
hold off
subplot(212)
hold on
m1=sin(2*pi*t)
plot(m1,'blue')
title('sin wave')
xlabel('time')
ylabel('amplitude')
d=2*pi/100
for n=1:1:100
if n==1
e1(n)=m1(n)
eq1(n)=d*sign(e1(n))
mq1(n)=eq1(n)
else
e1(n)=m1(n)-mq1(n-1)
eq1(n)=d*sign(e1(n))
mq1(n)=mq1(n-1)+eq1(n)
end
end
stairs(mq1,'black')
hleg=legend('original signal','stair case approximated signal')
hold off
plot(s)
xlabel('time')
ylabel('amplitude')
title('sampled signal')
n=3
y=uencode(s,n,1)
r=udecode(y,n,1)
figure(2)
subplot(211)
plot(y)
xlabel('time')
ylabel('amplitude')
title('encoded signal')
subplot(212)
plot(r)
xlabel('time')
ylabel('amplitude')
title('decoded signal')
figure(3)
plot(p)
xlabel('time')
ylabel('amplitude')
title('square signal')
Updates In Manual
Experiments list is revised again with the consensus of mentors.
In this manual contrary to last one we have included MATLAB coding and Simulink drills
for students. Experiments on digital communication as per HEC contents are included.
Required outcome of given assignment is also added for students to match their results
with the required one.
In each lab demo codes for student familiarization in each lab are added. During this
update time span available for lab is taken into mind. Focus on graphical result in time
domain and Frequency domain both are given.