0% found this document useful (0 votes)
26 views48 pages

Digital Communication Report

This document is a lab report for the Digital Communication Lab course, detailing various experiments conducted using MATLAB. It covers topics such as basic MATLAB operations, mathematical functions, and plotting techniques. The report includes objectives, descriptions, and examples for each experiment, aimed at enhancing students' understanding of digital communication concepts through practical application.

Uploaded by

mahatabuddin251
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views48 pages

Digital Communication Report

This document is a lab report for the Digital Communication Lab course, detailing various experiments conducted using MATLAB. It covers topics such as basic MATLAB operations, mathematical functions, and plotting techniques. The report includes objectives, descriptions, and examples for each experiment, aimed at enhancing students' understanding of digital communication concepts through practical application.

Uploaded by

mahatabuddin251
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 48

BACHELOR OF SCIENCE IN ELECTRICAL AND

ELECTRONIC ENGINEERING

REPORT/ LAB REPORT/ ASSIGNMENT


Course Name: Digital Communication Lab
Course Code: EEE3202

Submitted By:

Student’s Name: Ala Uddin


ID: 008-37-17
Semester: Spring-2024
Submission Date:
Submitted To:
Teacher’s Name: Rubel Kanti Das
Designation: Lecturer
Department: EEE
Southern University Bangladesh

REMARKS

Signature
Page | 1
INDEX
S.L. EXPERIMENT NAME PAGE REMARKS
NO.
1 Introduction to MATLAB 3 to 5
2 Some Mathematical Functions using MATLAB 6 t0 8
3 Basic Plotting in MATLAB 9 to 15
4 Amplitude Modulation using MATLAB 16 to 17
5 Frequency Modulation 18 to 19
6 Spectrum of amplitude Modulation 20 to 21
7 Spectrum of DSB SSB 22 to 24
8 Spectrum of Frequency Modulation 25 to 26
9 Amplitude Shift keying 27 to 29
10 Quadrature Phase Shift Keying 30 to 31
11 Binary Phase Shift Keying 32 to 33
12 Differential phase Shift Keying 34 to 36
13 PPM, FDM_Dmul 37 to 44
14 Code Division Multiple access 45 to 48

Page | 2
❖ EXPERIMENT NO: 01

❖ EXPERIMENT NAME: Introduction to MATLAB.

❖ OBJECTIVES:
1. Use MATLAB to perform complex arithmetic.
2. Generate and plot signals and complex valued functions.
3. Confidently develop MATLAB M-files and save results of computations from a
MATLAB session.

❖ INTRODUCTION:

The tutorials are independent of the rest of the document. The primarily objective is to help
you learn quickly the first steps. The emphasis here is “learning by doing”. Therefore, the
best way to learn is by trying it yourself. Working through the examples will give you a
feel
for the way that MATLAB operates. In this introduction we will describe how MATLAB
handles simple numerical expressions and mathematical formulas.

The name MATLAB stands for Matrix laboratory. MATLAB was written originally
to provide easy access to matrix software developed by the LINPACK (linear system
package)
and EISPACK (Eigen system package) projects.

MATLAB is a high-performance language for technical computing. It integrates


computation, visualization, and programming environment. Furthermore, MATLAB is a
modern programming language environment: it has sophisticated data structures, contains
built-in editing and debugging tools, and supports object-oriented programming. These
factors
make MATLAB an excellent tool for teaching and research.

❖ Basic features:
As we mentioned earlier, the following tutorial lessons are designed to get you started
quickly in MATLAB. The lessons are intended to make you familiar with the basics of
MATLAB. We urge you to complete the exercises given at the end of each lesson.

❖ A minimum MATLAB session:


The goal of this minimum session (also called starting and exiting sessions) is to learn the
first steps:
▪ How to log on
Page | 3
▪ Invoke MATLAB
▪ Do a few simple calculations
▪ How to quit MATLAB
❖ Starting MATLAB:
After logging into your account, you can enter MATLAB by double-clicking on the MATLAB
shortcut icon (MATLAB 7.0.4) on your Windows desktop. When you start MATLAB, a
special window called the MATLAB desktop appears. The desktop is a window that contains
other windows. The major tools within or accessible from the desktop are:
▪ The Command Window
▪ The Command History
▪ The Workspace
▪ The Current Directory
▪ The Help Browser
▪ The Start button

❖ Desktop Tools:

▪ Command Window: Use the Command Window to enter variables and run functions and
M-files.
▪ Command History: Statements you enter in the Command Window are logged in the
Command History. In the Command History, you can view previously run statements, and
copy and execute selected statements.
▪ Current Directory Browser: MATLAB file operations use the current directory reference
point. Any file you want to run must be in the current directory or on the search path.
▪ Workspace: The MATLAB workspace consists of the set of variables (named arrays)
built up during a MATLAB session and stored in memory

Figure 1.1: The graphical interface to the MATLAB workspace


Page | 4
❖ Editor/Debugger Window: Use the Editor/Debugger to create and debug M-files.

❖ Basic Commands:

❖ clear Command: Removes all variables from workspace.


❖ clc Command: Clears the Command window and homes the cursor.
❖ help Command: help <Topic> displays help about that Topic if it exists.
❖ Okafor Command: Provides help by searching through all the first lines of
MATLAB help topics and returning those that contains a key word you specify.
❖ edit Command: enable you to edit (open) any M-file in Editor Window. This
command doesn’t open built-in function like, sqrt. See also type Command.
❖ more command: more on enables paging of the output in the MATLAB
command window, and more off disables paging of the output in the MATLAB
command window.

❖ Discussion: Through this experiment we can gain general knowledge about MATLAB and know
how to write a program.

Page | 5
❖ Experiment No: 2
❖ Experiment Name: Mathematical Function Using MATLAB.

❖ Description:

Creating mathematical functions in MATLAB is straightforward. You can define functions using
built-in MATLAB functions or create your own custom functions. Here's a description of how you
can define and use mathematical functions in MATLAB:

❖ Built Functions:
MATLAB provides a wide range of built-in mathematical functions for various operations,
including basic arithmetic, trigonometry, exponentiation, logarithms, and more. These functions
can be used directly in your MATLAB scripts or functions. For example:

❖ MATLAB Code.
% Example of using built-in functions
x = linspace(0, 2*pi, 100); % Generate 100 points between 0 and 2*pi
y = sin(x); % Calculate the sine of each element in x

MATLAB offers a vast array of built-in functions for mathematical operations. These
functions cover a wide range of mathematical domains, including basic arithmetic,
trigonometry, exponential and logarithmic functions, matrix operations, statistical
functions, and more
Here are some examples of commonly used built-in functions:
Basic arithmetic: +, -, *, /, ^
Trigonometric functions: sin, cos, tan, asin, acos, atan
Exponential and logarithmic functions: exp, log, log10
Complex numbers: real, imag, abs, angle
Matrix operations: transpose, inv, det
Statistical functions: mean, median, std, var

You can find a comprehensive list of MATLAB's built-in functions in the official
documentation or by using the help command followed by the function name.

Page | 6
❖ Element – wise Operations:
MATLAB operates on arrays and matrices by default, allowing you to perform element-
wise operations on entire arrays. This means that if you have an array of numbers, you can
apply a mathematical function to each element of the array at once. For example:

❖ MATLAB Code.
% Example of element-wise operations
x = [1, 2, 3, 4];
y = sqrt(x); % Calculate the square root of each element in x

❖ Anonymous Functions:

You can create anonymous functions in MATLAB using the @(arguments) expression
syntax. These functions can be defined on the fly and are useful for simple mathematical
operations or as arguments to other functions. For example:
❖ MATLAB Code.

% Example of anonymous functions


f = @(x) x.^2 + 3*x + 2; % Define a quadratic function

❖ Custom Function:

MATLAB allows you to define your own custom functions using the function keyword.

You can create separate .m files for your functions and call them from your main script or
other functions. For example, suppose you want to define a function to calculate the area
of a circle:

❖ MATLAB Code.
% Example of custom function definition
function area = circle_area(radius)
area = pi * radius^2;
end
You can then call this function from your main script or other functions:
Page | 7
❖ MATLAB Code.
% Example of calling a custom function
radius = 5;
area = circle_area(radius);
disp(area); % Display the calculated area

❖ Discussion: We have learned through this experiment how mathematical functions work in
MATLAB. Our teacher helped us to do this experiment.

Page | 8
❖ Experiment No: 3

❖ Experiment Name: Basic Plating in MATLAB.

❖ OBJECTIVES:

▪ Define x, by specifying the range of values for the variable x, for which the function is
to be plotted.
▪ Define the function, y = f(x)
▪ Call the plot command, as plot (x, y)
❖ Introduction: Plot (X , Y ) creates a 2-D line plot of the data in Y versus the corresponding
values in X . To plot a set of coordinates connected by line segments, specify X and Y as
vectors of the same length. To plot multiple sets of coordinates on the same set of axes,
specify at least one of X or Y as a matrix.
❖ Fundamentals:
MATLAB works with essentially one kind of object, a rectangular numerical matrix.
Vectors and scalars are referred to as n-by-1 and 1-by-1 matrices respectively. Here is some
basic information on using MATLAB matrix commands.
❖ Entering Matrices
The matrix
132
A= 241
668

can be entered into Matlab by typing the following three lines. Each line ends by pressing
the Return key.

132
A= 241
668

❖ Generating Vectors with Even Space


To plot a function, you must rest specify the data points at which the function will be evaluated. It is
common to choose evenly spaced points and put them in a vector. Here is how you generate a row
vector X containing the values from 0 to 10 in increments of 0.2.

X = 0 : 0.2 : 10
❖ Array Operations

This term is used to refer to element-by-element arithmetic operations on vectors, instead of


the usual linear algebra operations denoted by the symbols *, /, or ^ (exponentiation).
Page | 9
Preceding an operator with a period. indicates an array or element-by-element operation.

For example, if X = [1 2 3] and Y = [4 5 6]; then


X: Y = [4 10 18].

Notice that the usual vector product X Y is undened.


The Matlab ob ject ones(m,n) is useful if you want to add or subtract a constant from each
element in a vector. ones(m,n) is an m-by-n matrix of ones. Using the vector X from the last
example, you write the expression X + 2 as follows in Matlab notation.
X + 2 * ones (1,3)

The dimension of one’s vector must match the other vectors in the computation. The
command size(A) returns the dimension of a vector or matrix A.

❖ Basic Overview:

To use the ‘plot’ function in Matlab, you should first make sure that the matrices/vectors
you are trying to use are of equal dimensions. For example, if I wanted to plot vector X = [3 9
27] over time, my vector for time would also need to be a 1x3 vector (i.e. t = [1 2 3]).

Syntax

To plot the example vectors above in a new figure:


clear all % clear all previous variables
X = [3 9 27]; % my dependent vector of interest
t = [1 2 3]; % my independent vector
figure % create new figure
plot(t, X)

Labeling Axes

To give the above figure a title and axis labels:


title(‘Plot of Distance over Time’) % title
ylabel(‘Distance (m)’)
% label for y axis
xlabel(‘Time (s)’)
% label for x axis

Page | 10
Legends
If you have plotted multiple dependent vectors on the same plot and want to distinguish
them from each other via a legend, the syntax is very similar to the axis labeling above.
It is also possible to set colors for the different vectors and to change the location of the
legend on the figure.

Example:

clear all
X = [3 9 27]; % dependent vectors of interest
Y = [10 8 6];
Z = [4 4 4];
t = [1 2 3]; % independent vector
figure
hold on % allow all vectors to be plotted in same
% figure
plot(t, X, ‘blue’, t, Y, ‘red’, t, Z, ‘green’)
title(‘Plot of Distance over Time’) % title
ylabel(‘Distance (m)’) % label for y axis
xlabel(‘Time (s)’) % label for x axis
legend(‘Trial 1’, ‘Trial 2’, ‘Trial 3’)
legend(‘Location’,‘NorthWest’) % move legend to upper left

Page | 11
❖ Subplots
It can sometimes be useful to display multiple plots on the same figure for comparison.
This can be done using the subplot function, that takes arguments for number of rows of
plots,
number of columns of plots, and plot number currently being plotted:

Example:

clear all
close all
% subplot (nrows,ncols,plot_number)
x=0:.1:2*pi; % x vector from 0 to 2*pi, dx = 0.1
subplot(2,2,1); % plot sine function
plot(x,sin(x));
subplot(2,2,2); % plot cosine function
plot(x,cos(x));
subplot(2,2,3) % plot negative exponential function
plot(x,exp(-x));
subplot(2,2,4); % plot x^3
plot(x, x.^3);

Page | 12
❖ Plotting in 3-D
There are also ways to plot in multiple dimensions in Matlab*. One type of 3-D plot that
may be useful is a surface plot, which requires you to generate some kind of x-y plane and
then apply a 3rd function as the z dimension.

Example:

clear all
close all
[x,y] = meshgrid([-2:.2:2]); % set up 2-D plane
Z = x.*exp(-x.^2-y.^2); % plot 3rd dimension on plane
figure
surf(x,y,Z,gradient(Z)) % surface plot, with gradient(Z)
% determining color distribution
colorbar
% display color scale, can adjust
% location similarly to legend

Page | 13
❖ Making Plots
Matlab provides a variety of functions for displaying data as 2-D or 3-D graphics. For 2-D
graphics, the basic command is:
plot (x1, y1, 'line style', x2, y2, 'line style'...)
This command plots vector x1 versus vector y1, vector x2 versus vector y2, etc. on the same
graph. Other commands for 2-D graphics are: polar, bar, stairs, loglog, semilogx, and
semilogy.
For 3-D graphics, the most commonly used commands are:

plot3(x1, y1, z1, 'line style', x2, y2, z2, 'line style'...)
contour(x,y,Z)
mesh(x,y,Z), surf(x,y,Z)

Page | 14
❖ Plotting Mathematical Functions:

MATLAB also provides powerful plotting capabilities for visualizing mathematical functions.
You can use functions like plot, fplot, surf, etc., to create 2D and 3D plots of mathematical
functions.

❖ MATLAB Code.
% Example of plotting a mathematical function
x = linspace(-2*pi, 2*pi, 100); % Generate 100 points between -2*pi and 2*pi
y = sin(x); % Calculate the sine function values
plot(x, y); % Plot the sine function
title('Plot of y = sin(x)');
xlabel('x');
ylabel('y');
grid on; % Add grid lines to the plot
These are some of the basic techniques for working with mathematical functions in MATLAB.
MATLAB's extensive documentation and online resources provide further guidance and
examples for more advanced operations and applications.

❖ Discussion: We have learned through this experiment how Basic Plating work in
MATLAB. Our teacher helped us to do this experiment.

Page | 15
❖ Experiment No: 4

❖ Experiment Name: Amplitude Modulation using MATLAB

❖ Description: Amplitude modulation (AM) is a modulation technique used in electronic


communication, most commonly for transmitting messages with a radio wave. In
amplitude modulation, the amplitude (signal strength) of the wave is varied in proportion
to that of the message signal, such as an audio signal.

❖ MATLAB Source Code:


fs=8000;
fm=20;
fc=500;
Am=1;
Ac=1;
t=[0:.1*fs]/fs;
m=Am*cos(2*pi*fm*t);
c=Ac*cos(2*pi*fc*t);
ka=0.5;
u=ka*Am;
s1=Ac*(1+u*cos(2*pi*fm*t)).*cos(2*pi*fc*t);
subplot(4,3,1:3);
plot(t,m);
title('Modulating or Message signal(fm=20Hz)');
subplot(4,3,4:6);
plot(t,c);
title('Carrier signal(fc=500Hz)');
subplot(4,3,7);
plot(t,s1);
title( 'Under Modulated signal(ka.Am=0.5)');
Am=2;
ka=0.5;
u=ka*Am;
s2=Ac*(1+u*cos(2*pi*fm*t)).*cos(2*pi*fc*t);
subplot(4,3,8);
plot(t,s2);
title( 'Exact Modulated signal(ka.Am=1)');
Am=5;
ka=0.5;
u=ka*Am;
s3=Ac*(1+u*cos(2*pi*fm*t)).*cos(2*pi*fc*t);
subplot(4,3,9);
plot(t,s3);

Page | 16
title('Over Modulated signal(ka.Am=2.5)');
r1= s1.*c;
[b a] = butter(1,0.01);
mr1= filter(b,a,r1);
subplot(4,3,10);
plot(t,mr1);
r2= s2.*c;
[b a] = butter(1,0.01);
mr2= filter(b,a,r2);
subplot(4,3,11);
plot(t,mr2);
r3= s3.*c;
[b a] = butter(1,0.01);
mr3= filter(b,a,r3);
subplot(4,3,12);
plot(t,mr3);

❖ Result:

❖ Discussion: Through this experiment we learned how Expect Tram of (Amplitude


Modulation) works and how to program it in MATLAB software. Our teacher helped
us to run my program without any problems.
Page | 17
❖ Experiment No: 5

❖ Experiment Name: Frequency Modulation.

❖ Description: Frequency Modulation (FM) is the encoding of information in a carrier


wave by changing the instantaneous frequency of the wave. FM technology is widely used
in the fields of computing, telecommunications, and signal processing. frequency
modulation is a technique or a process of encoding information on a particular signal
(analogue or digital) by varying the carrier wave frequency in accordance with the
frequency of the modulating signal. As we know, a modulating signal is nothing but
information or message that has to be transmitted after being converted into an electronic
signal.

Much like amplitude modulation, frequency modulation also has a similar approach, where
a carrier signal is modulated by the input signal. However, in the case of FM, the amplitude
of the modulated signal is kept, or it remains constant.

❖ MATLAB Source Code:

The frequency modulation (FM) waveform in time and frequency domain.

%fm=35HZ, fc=500HZ, Am=1V, Ac=1V, B=10


fs=10000;
Ac=1;
Am=1;
fm=35;
fc=500;
B=10;
t=(0:0.1*fs)/fs;
wc=2*pi*fc;
wm=2*pi*fm;
m_t=Am*cos(wm*t);
subplot(5,1,1);
plot(t,m_t);
title('Modulating or Message signal(fm=35Hz)');
c_t=Ac*cos(wc*t);
subplot(5,1,2);
plot(t,c_t);
title('Carriersignal(fm=500Hz)');
s_t=Ac*cos((wc*t)+B*sin(wm*t));
Page | 18
subplot(5,1,3);
plot(t,s_t);
title('Modulatedsignal');
d=demod(s_t,fc,fs,'fm');
subplot(5,1,4);
plot(t,d);
title('demodulated signal');

❖ Result:

❖ Discussion: Through this experiment we learned how Expect Tram of (Frequency


Modulation) works and how to program it in MATLAB software. Our teacher helped us to
run my program without any problems.

Page | 19
❖ Experiment No: 6

❖ Experiment Name: Spectrum of amplitude Modulation.

❖ Description: The spectrum of an amplitude modulated is related to the sidebands that are
generated and hence to the bandwidth. The bandwidth of an amplitude modulated signal is
of importance for many reasons. The amplitude modulation, AM bandwidth is important
when designing filters to receive the signals, determining the channel spacing, and for a
number of other reasons.
The spectrum and bandwidth of an amplitude modulated signal are determined by the
sidebands that are generated when amplitude modulation is applied to the carrier.

It can be seen that if the top frequency that is modulated onto the carrier is 6 kHz, then the
top spectra will extend to 6 kHz above and below the signal. In other words, the bandwidth
occupied by the AM signal is twice the maximum frequency of the signal that is used to
modulated the carrier, i.e., it is twice the bandwidth of the audio signal to be carried.

❖ MATLAB Source Code:

%program of spectrum analyzer and analysis of am

Fs = 100; %sampling frq


t = [0:2*Fs+1]'/Fs;
Fc = 10; % Carrier frequency
x = sin(2*pi*2*t); % message signal Ac=1;
% compute spectra of am xam=ammod(x, Fc, Fs, 0, Ac);
zam = fft(xam);
zam = abs(zam(1:length(zam)/2+1));
frqam = [0:length(zam)-1]*Fs/length(zam)/2;
% compute spectra of dsbsc
ydouble = ammod (x, Fc, Fs, 3.14,0);
zdouble = fft(ydouble);
zdouble = abs (zdouble(1:length(zdouble)/2+1));
frqdouble = [0:length (zdouble)-1]*Fs/length (zdouble)/2;
% compute spectra of ssb
ysingle = ssbmod(x, Fc, Fs, 0, 'upper');
zsingle = fft(ysingle);
zsingle = abs (zsingle (1:length (zsingle)/2+1));
: length (zsingle)-1]*Fs/length (zsingle)/2; frqsingle = [0:length(zsing]
% Plot spectrums of am dsbsc and ssb
figure;
subplot(3,1,1); plot(frqam, zam); title('Spectrum of am signal');

Page | 20
subplot(3,1,2); plot(frqdouble, zdouble);
title('Spectrum of double-sideband signal');
subplot(3,1,3); plot(frqsingle, zsingle);
title('Spectrum of single-sideband signal');

❖ Result:

❖ Discussion: Through this experiment we learned how Expect Tram of Spectrum of


amplitude Modulation works and how to program it in MATLAB software. Our teacher
helped us to run my program without any problems.

Page | 21
❖ Experiment No: 7

❖ Experiment Name: Spectrum of DSB SSB.

❖ Description:
DSB: Double-sideband suppressed-carrier transmission (DSB-SC) is transmission in
which frequencies produced by amplitude modulation (AM) are symmetrically spaced
above and below the carrier frequency and the carrier level is reduced to the lowest
practical level, ideally being completely suppressed.
In the DSB-SC modulation, unlike in AM, the wave carrier is not transmitted; thus, much
of the power is distributed between the side bands, which implies an increase of the cover
in DSB-SC, compared to AM, for the same power use.
DSB-SC transmission is a special case of double-sideband reduced carrier transmission. It
is used for radio data systems. This mode is frequently used in amateur radio voice
communications, especially on high-frequency bands
SSB: single-sideband suppressed-carrier modulation (SSB-SC) is a type
of modulation used to transmit information, such as an audio signal, by radio waves. A
refinement of amplitude modulation, it uses transmitter power and bandwidth more
efficiently. Amplitude modulation produces an output signal the bandwidth of which is
twice the maximum frequency of the original baseband signal. Single-sideband modulation
avoids this bandwidth increase, and the power wasted on a carrier, at the cost of increased
device complexity and more difficult tuning at the receiver.

❖ MATLAB Source Code:


t=0:0.0001:1;
fm=input('enter the msg frequency');
am=input('enter the msg amplitude');
fc=input('enter carrier signal frequency');
ac=input('enter amplitude of carrier signal');
m=am*cos(2*pi*fm*t);
c=cos(2*pi*fc*t);
x=m.*c;
mod=x+(ac.*c);

%plot
subplot(4,1,1),plot(t,m);
xlabel('time');
ylabel('amplitude');

Page | 22
legend('Message signal m(t)');
title('message');

subplot(4,1,2),plot(t,c);
xlabel('time');
ylabel('amplitude');
legend('Carrier signal c(t)');
title('carrier');

subplot(4,1,3),plot(t,mod);
xlabel('time');
ylabel('amplitude');
legend('Amplitude modulated signal s(t)');
title('mod');

%fm signal

b=(fc-fm)/fm;

modfm=ac.*cos(2*pi*fc.*t + b*sin(2*pi*fm.*t));
subplot(4,1,4)
plot(t,modfm);
xlabel('time---(sec)');
ylabel('amp');
legend('Frequency modulated signal s(t)');
title('FM signal')

………….

Enter the msg frequency=30


Enter the msg amplitude=25
Enter carrier signal frequency=24
Enter amplitude of carrier signal=22

Page | 23
❖ Result:

❖ Discussion: Through this experiment we learned how Expect Tram of Spectrum of DSB
SSB works and how to program it in MATLAB software. Our teacher helped us to run my
program without any problems.

Page | 24
❖ Experiment No: 8

❖ Experiment Name: Spectrum of Frequency Modulation.

❖ Description: Frequency modulation (FM) is a technique used in telecommunications and


signal processing where the frequency of a carrier signal is varied in proportion to the
amplitude of a modulating signal. The spectrum of frequency modulation refers to the
distribution of power or amplitude across different frequencies in the modulated signal.
When a modulating signal, such as an audio waveform, is applied to vary the frequency of
the carrier signal, the resulting modulated signal contains additional frequencies beyond
those present in the original carrier signal. These additional frequencies create sidebands
around the carrier frequency in the frequency domain.
1. The spectrum of an FM signal typically consists of the following components:
2. Carrier frequency: This is the central frequency of the modulated signal. It is the
frequency that is varied in proportion to the modulating signal.
Sidebands: FM modulation creates sidebands on both sides of the carrier frequency. The
sidebands contain the spectral content of the original modulating signal. In FM, the
amplitude of the sidebands is directly related to the amplitude of the modulating signal.
The sidebands are symmetrically distributed around the carrier frequency.
1. Upper sideband (USB): Frequencies above the carrier frequency.
2. Lower sideband (LSB): Frequencies below the carrier frequency.
a. The width of the sidebands in FM is determined by the frequency deviation, which is the
maximum amount by which the carrier frequency is allowed to deviate from its nominal
frequency.
b. The spectrum of an FM signal can be visualized using techniques such as Fourier analysis
or spectral analysis. MATLAB provides functions for analyzing and visualizing spectra,
such as the function for computing the discrete Fourier transform (DFT) and the plot
function for plotting frequency spectra.
c. When plotting the spectrum of an FM signal in MATLAB, you can use the fft function to
compute the frequency spectrum of the modulated signal and then plot the magnitude or
power of the spectrum using the plot function.

Page | 25
❖ MATLAB Source Code:
%program of spectrum analyzer and analysis of Fm

Fs = 100; %sampling frq


t = [0:2*Fs+1]'/Fs;
Fc = 10; % Carrier frequency
x = sin(2*pi*2*t); % message signal
Ac=1;
% spectrum of fm
xfm=fmmod(x,Fc,Fs,10);
zfm = fft(xfm);
zfm = abs(zfm(1:length(zfm)/2+1));
frqfm = [0:length(zfm)-1]*Fs/length(zfm)/2;
figure;
plot(frqfm,zfm);
title('Spectrum of fm signal');

❖ Result:

❖ Discussion: Through this experiment we learned how Expect Tram of Spectrum of


Frequency Modulation works and how to program it in MATLAB software. Our teacher
helped us to run my program without any problems.

Page | 26
❖ Experiment No: 9

❖ Experiment Name: Amplitude Shift keying.

❖ Description: Amplitude-shift keying (ASK) is a form of amplitude modulation that


represents digital data as variations in the amplitude of a carrier wave. In an ASK system,
a symbol, representing one or more bits, is sent by transmitting a fixed-amplitude carrier
wave at a fixed frequency for a specific time duration. For example, if each symbol
represents a single bit, then the carrier signal could be transmitted at nominal amplitude
when the input value is 1, but transmitted at reduced amplitude or not at all when the input
value is 0.

❖ MATLAB Source Code:

%ASK Modulation
clc;
clear all;
close all;
%GENERATE CARRIER SIGNAL
Tb=1; fc=10;
t=0:Tb/100:1;
c=sqrt(2/Tb)*sin(2*pi*fc*t);
%generate message signal
N=8;
m=rand(1,N);
t1=0;t2=Tb
for i=1:N
t=[t1:.01:t2]
if m(i)>0.5
m(i)=1;
m_s=ones(1,length(t));
else
m(i)=0;
m_s=zeros(1,length(t));
end
message(i,:)=m_s;
%product of carrier and message
ask_sig(i,:)=c.*m_s;
t1=t1+(Tb+.01);
t2=t2+(Tb+.01);

Page | 27
%plot the message and ASK signal
subplot(5,1,2);axis([0 N -2 2]);plot(t,message(i,:),'r');
title('message signal');xlabel('t--->');ylabel('m(t)');grid on
hold on
subplot(5,1,4);plot(t,ask_sig(i,:));
title('ASK signal');xlabel('t--->');ylabel('s(t)');grid on
hold on

end
hold off
%Plot the carrier signal and input binary data
subplot(5,1,3);plot(t,c);
title('carrier signal');xlabel('t--->');ylabel('c(t)');grid on
subplot(5,1,1);stem(m);
title('binary data bits');xlabel('n--->');ylabel('b(n)');grid on
% ASK Demodulation
t1=0;t2=Tb
for i=1:N
t=[t1:Tb/100:t2]
%correlator
x=sum(c.*ask_sig(i,:));
%decision device
if x>0
demod(i)=1;
else
demod(i)=0;
end
t1=t1+(Tb+.01);
t2=t2+(Tb+.01);
end
%plot demodulated binary data bits
subplot(5,1,5);stem(demod);
title('ASK demodulated signal'); xlabel('n--->');ylabel('b(n)');grid on

Page | 28
❖ Result:

❖ Discussion: Through this experiment we learned how Expect Tram of Amplitude Shift
keying. Works and how to program it in MATLAB software. Our teacher helped us to run
my program without any problems

Page | 29
❖ Experiment No: 10

❖ Experiment Name: Quadrature Phase Shift Keying.

❖ Description: Quadrature Phase Shift Keying is a digital modulation method. In this


method, the phase of the carrier waveform is changed according to the digital baseband
signal. The phase of the carrier remains the same when the input logic is the 1 but goes a
phase shift when the logic is 0. In Quadrature Phase Shift Keying, two information bits are
modulated at once, unlike Binary Phase Shift Keying where only one bit is passed per
symbol. Here, there are four carrier phase offsets with a phase difference of ±90° for four
possible combinations of two bits (00, 01, 10, 11). Symbol duration in this modulation is
twice the bit duration.

❖ MATLAB Source Code:


% PROGRAM FOR QPSK GENERATION SCHEME
t=0:0.0001:0.25;
m=square(2*pi*10*t);
c1=sin(2*pi*60*t);
c2=sin(2*pi*60*t+180);
for i=1:2500
if(mod(i,1000))<500
s(i)=c1(i);
else
s(i)=-c2(i);
end
end
subplot(4,1,1);
plot(t,m,'k','linewidth',5);
title('polor representation of message 1 0 1 0 1 0');
xlabel('time'); ylabel('amplitude')
subplot(4,1,2); plot(c1);
title('frequency 1');
xlabel('time'); ylabel('amplitude');
subplot(4,1,3); plot(c2);
title('frequency 2');
xlabel('time'); ylabel('amplitude');
subplot(4,1,4); plot(s);
title('quadrature phase shift keying');
xlabel('time');
ylabel('amplitude');

Page | 30
❖ Result:

❖ Discussion: Through this experiment we learned how Expect Tram of Quadrature Phase
Shift Keying. Works and how to program it in MATLAB software. Our teacher helped us
to run my program without any problems

Page | 31
❖ Experiment No: 11

❖ Experiment Name: Binary Phase Shift Keying.

❖ Description: Binary Phase Shift Keying (BPSK) is a widely used modulation technique
in digital communication systems for transmitting binary data over a communication
channel. It is known for its simplicity and effectiveness, making it a popular choice in
applications where the communication channel is susceptible to noise and interference.
Binary Phase Shift Keying (BPSK) is a modulation technique employed in
communication systems to transmit information via a communication channel. In BPSK
the carrier signal is modified by altering its phase by 180 degrees, for each symbol. A
phase shift of 180 degrees denotes a binary 0 while no phase shift represents a binary 1.
The BPSKs modulation process is straightforward and efficient making it suitable for
scenarios where the communication channel suffers from noise and interference.

BPSK holds significance in communication systems like Wi-Fi, Bluetooth and satellite
communication. Its simplicity and robustness make it an excellent choice for applications
where the quality of the communication channel isn’t optimal. Using a basic phase shift
to convey symbols BPSK can reliably transmit data, over channels guaranteeing
dependable communication.

❖ MATLAB Source Code:

d=[1 0 1 1 0]; % Data sequence


b=2*d-1; % Convert unipolar to bipolar
T=1; % Bit duration
Eb=T/2; % This will result in unit amplitude waveforms
fc=3/T; % Carrier frequency
t=linspace(0,5,1000); % discrete time sequence between 0 and 5*T (1000 samples)
N=length(t); % Number of samples
Nsb=N/length(d); % Number of samples per bit
dd=repmat(d',1,Nsb); % replicate each bit Nsb times
bb=repmat(b',1,Nsb);
dw=dd'; % Transpose the rows and columns
dw=dw(:)'; % Convert dw to a column vector (colum by column) and convert to a
row vector
bw=bb';
Page | 32
bw=bw(:)'; % Data sequence samples
w=sqrt(2*Eb/T)*cos(2*pi*fc*t); % carrier waveform
bpsk_w=bw.*w; % modulated waveform
% plotting commands follow
subplot(4,1,1);
plot(t,dw); axis([0 5 -1.5 1.5])
subplot(4,1,2);
plot(t,bw); axis([0 5 -1.5 1.5])
subplot(4,1,3);
plot(t,w); axis([0 5 -1.5 1.5])
subplot(4,1,4);
plot(t,bpsk_w,'.'); axis([0 5 -1.5 1.5])
xlabel('time')

❖ Result:

❖ Discussion: Through this experiment we learned how Expect Tram of Binary Phase Shift
Keying. Works and how to program it in MATLAB software. Our teacher helped us to run
my program without any problems

Page | 33
❖ Experiment No: 12

❖ Experiment Name: Differential phase Shift Keying.

❖ Description: Differential phase shift keying (DPSK) is a common form of phase


modulation that conveys data by changing the phase of the carrier wave. As mentioned for
BPSK and QPSK there is an ambiguity of phase if the constellation is rotated by some
effect in the communications channel through which the signal passes.
The DPSK stands for “Differential phase-shift keying”. It is one type of phase modulation
used to transmit data by altering the carrier wave’s phase. In this, the modulated signal’s
phase is moved e to the element of an earlier signal. The phase of the signal tracks the low
or high state of the earlier element. This kind of phase-shift keying doesn’t require a
synchronous carrier on the demodulator.
The binary bits input series can be changed so that the next bit depends upon the earlier bit.
So, the earlier received bits in the receiver are utilized for detecting the current bit. The
above-shown figure is the DPSK waveform. From the above waveform, once the data-bit is
‘0’, the signal’s phase will not be inverted as well as continued. Once the data-bit is a ‘1’,
then the signal’s phase will be inverted.

❖ MATLAB Source Code:

%PROGRAM FOR DPSK GENERATION SCHEME:

rng default

M = 6; % Alphabet size

dataIn = randi([0 M-1],1011,1); % Random message

txSig = dpskmod(dataIn,M); % Modulate

rxSig = txSig*exp(2i*pi*rand());

dataOut = dpskdemod(rxSig,M);

errs = symerr(dataIn,dataOut)

errs = symerr(dataIn(2:end),dataIn(2:end))

figure

subplot(2,2,1)

Page | 34
plot(dataIn)

title('DATA')

subplot(2,2,2)

plot(txSig)

title('DPSK SIGNAL')

subplot(2,2,3)

plot(rxSig)

title('Received DPSK')

subplot(2,2,4)

plot(dataOut)title('DATA RECEIVED')

Page | 35
❖ Result:

❖ Discussion: Through this experiment we learned how Expect Tram of Differential phase
Shift Keying. Works and how to program it in MATLAB software. Our teacher helped us
to run my program without any problems

Page | 36
❖ Experiment No: 13

❖ Experiment Name: PPM FDM_Dmul.

❖ Description:

PPM: This is a way of expressing very dilute concentrations of substances. Just as per
cent means out of a hundred, so parts per million or ppm means out of a million.
Usually describes the concentration of something in water or soil. One ppm is
equivalent to 1 milligram of something per liter of water (mg/l) or 1 milligram of
something per kilogram soil (mg/kg).

FDM_Dmul: In frequency-division multiplexing (FDM), multiple signals are combined


for transmission on a single communications line or channel, with each signal assigned to a
different frequency (subchannel) within the main channel.

To accommodate the successful transmission of multiple signals over a single line, FDM
separates assigned bands by strips of unused frequencies called guard bands. This prevents
overlapping between signal frequencies over a shared medium.

A signal is generated and modulated by a sending device and is carried over the separated
bands. The modulated signals are combined using a multiplexer (mux) and transmitted over
the communication channel. At the receiving end, the combined signal goes through a
demultiplexer (demux) to extract the individual signals.

In FDM, a two-way communication circuit requires a mux/demux at either end.


Multiplexing is used when frequencies (signals) of lower bandwidth are transmitted
through a channel with a higher bandwidth.

Page | 37
❖ MATLAB Source Code:

%program for frequency division multiplexing and demultiplexing


close all;
clear all;
clc;
Fs = 100; % sampling freq
t = [0:2*Fs+1]'/Fs;
x1 = sin(2*pi*2*t); % signal 1 signal
z1 = fft(x1);
z1=abs(z1);
x2 = sin(2*pi*10*t); % signal 2 signal
z2 = fft(x2);
z2=abs(z2);
figure;
subplot(4,1,1);
plot(x1);
title('signal 1');
xlabel('time');
ylabel('amplitude');
subplot(4,1,2);
plot(x2);
title('signal 2');
xlabel('time');
ylabel('amplitude');
subplot(4,1,3);
plot(z1);
title('Spectrum of signal 1');

Page | 38
xlabel('freqency');
ylabel('magnitude');
subplot(4,1,4);
plot(z2);
title('Spectrum of signal 2');
xlabel('freqency');
ylabel('magnitude');
% freqency multiplexing
z=z1+z2;
figure;
plot(z);
title('frequency multiplexed signals');
figure;
% freqency demultiplexing
f1=[ones(10,1); zeros(182,1);ones(10,1)];%applying filter for signal 1
dz1=z.*f1;
d1 = ifft(dz1);
subplot(2,1,1)
plot(t*100,d1);
f2=[zeros(10,1); ones(182,1);zeros(10,1)];% applying filter for signal 2
dz2=z.*f2;
d2 = ifft(dz2);
title('recovered signal 1');
xlabel('time');
ylabel('amplitude');
subplot(2,1,2)
plot(t*100,d2);
title('recovered signal 2');
xlabel('time');
ylabel('amplitude');

Page | 39
❖ Result:

Page | 40
Page | 41
Page | 42
❖ MATLAB Source Code:

fc=100; fs=1000;
f1=80; f2=300 ;
t=0:1/fs:((2/f1)-(1/fs));
x1=0.4*cos(2*pi*f1*t)+0.5;
%x2=0.2*(cos(2*pi*f1*t)+cos(2*pi*f2*t))+0.5 ;
subplot(4,2,1);
plot(x1);
title('original msg signal');
y1=modulate(x1,fc,fs,'ppm');subplot(4,2,2);
plot(y1)
axis([0 50 -0.2 1.2]);
title('ppm one of f1,fc=1000,f1=80 ');
fx1=abs(fft(y1,1024)) ;
fx1=[fx1(512:1024) fx1(1:513)];
f=[(511*fs/1024):(fs/1024):(512*fs/1024)];
subplot(4,2,3);
plot(fx1);
title('freq des ppm signal tone,fc=1000');
x1_recov = demod(y1,fc,fs,'ppm');
subplot(4,2,4);
plot(x1_recov);
title('time domain recovered signal');

Page | 43
❖ Result:

❖ Discussion: Through this experiment we learned how Expect Tram of PPM FDM_Dmul.
Works and how to program it in MATLAB software. Our teacher helped us to run my
program without any problems

Page | 44
❖ Experiment No: 14

❖ Experiment Name: Code Division Multiple access.

❖ Description: Code-division multiple access (CDMA) is a method of encoding several


sources of data so they may all be transmitted over a single RF carrier by one transmitter,
or by using a single RF carrier frequency with multiple transmitters.

In CDMA, all signals occupy the same frequency bandwidth and are transmitted
simultaneously in time, but the different signals are distinguished from one another at the
receiver by the specific spreading codes or frequency hopping pattern. Spread
spectrum multiple access (SSMA), which is the most popular CDMA, is achieved by two
techniques: direct sequence (DS) modulation and frequency hopping (FH) modulation. In
DS, the modulated signal is multiplied by pseudorandom noise (PN) codes with a chip rate
of Rc, which is much larger than an information bit rate of Rb. The resulting signal has
wider frequency bandwidth than the original modulated signal.

❖ MATLAB Source Code:


clc
x1 = [0 1 0 1 0 1 0 1];
d1 = [0 0];
t = [1:8];
num1=255;
a1 = dec2bin(num1) - '1';
b1 = bitxor(x1,a1)
subplot(4,1,1);stem(t,b1)
x2 = [0 0 1 1];
d2 = [1 0];
num2= 15;
a21 = dec2bin(num2) - '0';
b21 = bitxor(x2,a21);
Page | 45
num2= 15;
a22 = dec2bin(num2) - '1';
b22 = bitxor(x2,a22);
b2= [b21 b22]
subplot(4,1,2);stem(t,b2)
x3 = [0 0 0 0 0 0 0 0];
d3 = [1 1];
num1=255;
a3 = dec2bin(num1) - '0';
b3 = bitxor(x3,a3)
subplot(4,1,3);stem(t,b3)
i=1;

while i<9

if b1(i)== 0
b1(i)=1;
elseif b1(i)== 1
b1(i)= -1;
else
break
end
i=i+1;
end
fprintf('voltage converted spread signal of user1\n');
disp(b1)
i=1;
while i<9
Page | 46
if b2(i)== 0
b2(i)=1;
elseif b2(i)== 1
b2(i)= -1;
else
break
end
i=i+1;
end
fprintf('voltage converted spread signal of user2\n');
disp(b2)
i=1;
while i<9

if b3(i)== 0
b3(i)=1;
elseif b3(i)== 1
b3(i)= -1;
else
break
end
i=i+1;
end
fprintf('voltage converted spread signal of user3\n');
disp(b3)
b= b1+b2+b3
subplot(4,1,4); stem(t,b)
m = b.*b1
Page | 47
sum11 = m(1)+m(2)+m(3)+m(4);ave11 = sum11/4;
sum12 = m(5)+m(6)+m(7)+m(8);ave12 = sum12/4;
fprintf('%f %f\n',ave11,ave12);

❖ Result:

❖ Discussion: Through this experiment we learned how Expect Tram of Code Division
Multiple access. Works and how to program it in MATLAB software. Our teacher helped
us to run my program without any problems

Page | 48

You might also like