0% found this document useful (0 votes)
22 views70 pages

CS File Deepa

The document describes generating and plotting basic signals in MATLAB such as sinusoidal, exponential, unit step, unit impulse, ramp and other signals. It includes the theory, simulation platform, code and output of plotting the continuous and discrete time versions of these signals.
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)
22 views70 pages

CS File Deepa

The document describes generating and plotting basic signals in MATLAB such as sinusoidal, exponential, unit step, unit impulse, ramp and other signals. It includes the theory, simulation platform, code and output of plotting the continuous and discrete time versions of these signals.
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/ 70

DELHI TECHNOLOGICAL UNIVERSITY

SUBJECT: Communication Systems (EC206)

LAB FILE FOR EVEN SEMESTER 2021-22

SUBMITTED TO: Mr. Piyush Tiwari


Department of Electronics and Communication Engineering

SUBMITTED BY: Deepanshi Nagarwal 2K20/EC/76

1.
Experiment 1
Aim:
Generate and plot basic signals such as unit step, unit impulse, unit ramp, sinusoidal signals, exponential
signal, triangular wave, square wave, etc.

Theory:
Sinusoidal signal: Sinusoidal signal is in the form x(t) = Asin(wot+φ) or Acos(wot+ φ), where A represents
the amplitude and wo represents the angular frequency.

Unit Step Function: Unit Step Function is denoted by u(t) and is defined as,

It is discontinuous at t=0. In discrete form, it is given as,

Unit Impulse Function: Unit Impulse Function is denoted by δ(t) and is defined as,

Here, 1 determines the area. In discrete form, it is defined as,

2.
It has a value 1 at n=0. Unit impulse function can be obtained by differentiating the unit step function.

Ramp Function: Ramp signal is denoted by r(t) and defined as,

It can also be represented as, r(t) = u(t)*t.

Exponential Signal: Exponential signal is of the form,

If a is positive then value of function increases with increase in t and if a is negative the value of function
decreases with increase in t. If a is purely imaginary then we obtain the complex exponential function
which is a periodic signal and given as,

3.
Rectangular Pulse: Rectangular pulse is also known as the gate signal and is defined as,

rect(πt/τ) = {1, |t|< τ/2; 0, |t|> τ/2

Sinc Function: Sinc function is defined as, sinc(θ) = sin(π θ)/ π θ.

Simulation Platform:
MATLAB R2021a

Code:
close all
clear;

t=-2*pi:0.01:2*pi;
n=-5:1:5;

% Sine Function
x1=sin(t);
x1d=sin(n);
figure(1),subplot(3,2,1),plot(t,x1); %Plotting Continuous Function

4.
axis([(-2*pi),(2*pi),-1.5,1.5]),xlabel("t"),ylabel("Amplitude");
title("Sine");
figure(1),subplot(3,2,2),stem(n,x1d); %Plotting Discrete Function
axis([-5,5,-1.5,1.5]),xlabel("n"),ylabel("Amplitude");
title("Sine");

% Cosine Function
x2=cos(t);
x2d=cos(n);
figure(1),subplot(3,2,3),plot(t,x2); %Plotting Continuous Function
axis([(-2*pi),(2*pi),-1.5,1.5]),xlabel("t"),ylabel("Amplitude");
title("Cos");
figure(1),subplot(3,2,4),stem(n,x2d);%Plotting Discrete Function
axis([-5,5,-1.5,1.5]),xlabel("n"),ylabel("Amplitude");
title("Cos");

% Tan Function
x3=tan(t);
x3d=tan(n);
figure(1),subplot(3,2,5),plot(t,x3); %Plotting Continuous Function
% Tan function changes value very rapdily around +-npi/2 due to which large
% values dominates over the smaller values and it can't be plotted properly
% in continuous form.To correct this, we can set y-axis value or use
% markers or increase the step size. We can also use ezplot() function of
% MATLAB which plots predefined functions.
xlim([(-2*pi),(2*pi)]),ylim([-10 10]),xlabel("t"),ylabel("Amplitude");
title("Tan");
figure(1),subplot(3,2,6),stem(n,x3d); %Plotting Discrete Function
xlabel("n"),ylabel("Amplitude");
title("Tan");

% Exponential Function with positive coefficient


x4=exp(0.5*t);
x4d=exp(0.5*n);
x5=exp(5*t);
x5d=exp(5*n);
figure(2),subplot(2,2,1),plot(t,x4); %Plotting Continuous Function with small a.
xlim([(-2*pi),(2*pi)]),xlabel("t"),ylabel("Amplitude");
title("Exp (a=+0.5)");
figure(2),subplot(2,2,2),stem(n,x4d); %Plotting Discrete Function with small a.
xlabel("n"),ylabel("Amplitude");
title("Exp (a=+0.5)");
figure(2),subplot(2,2,3),plot(t,x5); %Plotting Continuous Function with large a.
xlim([(-2*pi),(2*pi)]),xlabel("t"),ylabel("Amplitude");
title("Exp (a=+5)");
figure(2),subplot(2,2,4),stem(n,x5d); %Plotting Discrete Function with large a.

5.
xlabel("n"),ylabel("Amplitude");
title("Exp (a=+5)");

% Exponential Function with negative coefficient


x6=exp(-0.5*t);
x6d=exp(-0.5*n);
x7=exp(-5*t);
x7d=exp(-5*n);
figure(3),subplot(2,2,1),plot(t,x6); %Plotting Continuous Function with small
negative a.
xlim([(-2*pi),(2*pi)]),xlabel("t"),ylabel("Amplitude");
title("Exp (a=-0.5)");
figure(3),subplot(2,2,2),stem(n,x6d); %Plotting Discrete Function with small
negative a.
xlabel("n"),ylabel("Amplitude");
title("Exp (a=-0.5)");
figure(3),subplot(2,2,3),plot(t,x7); %Plotting Continuous Function with large
negative a.
xlim([(-2*pi),(2*pi)]),xlabel("t"),ylabel("Amplitude");
title("Exp (a=-5)");
figure(3),subplot(2,2,4),stem(n,x7d); %Plotting Discrete Function with large
negative a.
xlim([-5 5]),xlabel("n"),ylabel("Amplitude");
title("Exp (a=-5)");

% Unit Step Function


x8=(t>0);
x8d=(n>0);
figure(4),subplot(3,2,1),plot(t,x8); %Plotting Continuous Function.
axis([(-2*pi),(2*pi),0,1.5]),xlabel("t"),ylabel("Amplitude");
title("Unit Step");
figure(4),subplot(3,2,2),stem(n,x8d); %Plotting Discrete Function.
ylim([0 1.5]),xlabel("n"),ylabel("Amplitude");
title("Unit Step");

% Ramp Function
x9=t.*(t>0);
x9d=n.*(n>0);
figure(4),subplot(3,2,3),plot(t,x9); %Plotting Continuous Function.
xlim([(-2*pi),(2*pi)]),xlabel("t"),ylabel("Amplitude");
title("Ramp");
figure(4),subplot(3,2,4),stem(n,x9d); %Plotting Discrete Function.
xlabel("n"),ylabel("Amplitude");
title("Ramp");

% Rectangular Pulse Function

6.
x10=rectpuls(t/2);
x10d=rectpuls(n/3);
figure(4),subplot(3,2,5),plot(t,x10); %Plotting Continuous Function.
axis([(-2*pi) (2*pi) 0 1.5]),xlabel("t"),ylabel("Amplitude");
title("Rectpulse");
figure(4),subplot(3,2,6),stem(n,x10d); %Plotting Discrete Function.
axis([-5 5 0 1.5]),xlabel("n"),ylabel("Amplitude");
title("Rectpulse");

% Sinc Function
x11=sinc(t);
x11d=sinc(n/2);
figure(5),subplot(3,2,1),plot(t,x11); %Plotting Continuous Function.
axis([(-2*pi),(2*pi),-1,1.5]),xlabel("t"),ylabel("Amplitude");
title("Sinc");
figure(5),subplot(3,2,2),stem(n,x11d); %Plotting Discrete Function.
ylim([-0.5 1.5]),xlabel("n"),ylabel("Amplitude");
title("Sinc");

% Complex Exponential Function


w=1;
z=1j*w;

x12=exp(z*t);
x12d=exp(z*n);
figure(5),subplot(3,2,3),plot(t,real(x12)); %Plotting Real part of Continuous
Function.
axis([(-2*pi),(2*pi),-1.5,1.5]),xlabel("t"),ylabel("Amplitude");
title("Complex Exp (Real)");
figure(5),subplot(3,2,4),stem(n,real(x12d)); %Plotting Real part of Discrete
Function.
ylim([-1.5 1.5]),xlabel("n"),ylabel("Amplitude");
title("Complex Exp (Real)");
figure(5),subplot(3,2,5),plot(t,imag(x12)); %Plotting Imaginary part of
Continuous Function.
axis([(-2*pi),(2*pi),-1.5,1.5]),xlabel("t"),ylabel("Amplitude");
title("Complex Exp (Imaginary)");
figure(5),subplot(3,2,6),stem(n,imag(x12d));%Plotting Imaginary part of Discrete
Function.
ylim([-1.5 1.5]),xlabel("t"),ylabel("Amplitude");
title("Complex Exp (Imaginary)");

% Unit Impulse
t1=-2:0.01:2;
x13=(t1==0);
x13d=(n==0);

7.
figure(6),subplot(3,2,1),plot(t1,x13); %Plotting Continuous Function.
ylim([0 1.5]),xlabel("t"),ylabel("Amplitude");
title("Impulse");
figure(6),subplot(3,2,2),stem(n,x13d); %Plotting Discrete Function.
ylim([0 1.5]),xlabel("n"),ylabel("Amplitude");
title("Impulse");

% Heaviside Function
x14=heaviside(t1);
x14d=heaviside(n);
figure(6),subplot(3,2,3),plot(t1,x14); %Plotting Continuous Function.
ylim([0 1.5]),xlabel("t"),ylabel("Amplitude");
title("Heaviside Function");
figure(6),subplot(3,2,4),stem(n,x14d); %Plotting Discrete Function.
ylim([0 1.5]),xlabel("n"),ylabel("Amplitude");
title("Heaviside Function");

% Dirac Delta Function


x15=dirac(t1);
x15=x15==Inf;
x15d=dirac(n);
x15d=x15d==Inf;
figure(6),subplot(3,2,5),plot(t1,x15); %Plotting Continuous Function.
ylim([0 1.5]),xlabel("t"),ylabel("Amplitude");
title("Dirac Delta Function");
figure(6),subplot(3,2,6),stem(n,x15d); %Plotting Discrete Function.
ylim([0 1.5]),xlabel("n"),ylabel("Amplitude");
title("Dirac Delta Function");

%Square Pulse:
x16=square(t);
x16d=square(n);
figure(7),subplot(3,2,1),plot (t, x16);
axis([(-2*pi) (2*pi) -1.5 1.5]);
xlabel("Time(sec)"), ylabel("Amplitude");
title ("Square Pulse");
figure(7),subplot(3,2,2),stem(n, x16d);
axis([(-2*pi) (2*pi) -1.5 1.5]);
xlabel("n"), ylabel("Amplitude");
title ("Square Pulse");

%Triangular Pulse:
x17=tripuls(t);
x17d=tripuls(n);
figure(7),subplot(3,2,3),plot(t, x17);
axis([(-2*pi) (2*pi) -1.5 1.5]);

8.
xlabel("Time(sec)"), ylabel("Amplitude");
title ("Triangular Pulse");
figure(7),subplot(3,2,4),stem(n, x17d);
axis([(-2*pi) (2*pi) -1.5 1.5]);
xlabel("n"), ylabel("Amplitude");
title ("Triangular Pulse");

%Envelope of exponential:
[up,lo] = envelope(x4);
hold on
figure(7),subplot(3,2,5),plot(t,up,t,lo);
xlim([(-2*pi) (2*pi)]),xlabel("Time(sec)"),ylabel("Amplitude");
title("Envelope");
hold off

[up,lo] = envelope(x4d);
hold on
figure(7),subplot(3,2,6),plot(n,up,n,lo);
xlabel("Time(sec)"),ylabel("Amplitude");
title("Envelope");
hold off

Function 1 to Plot Unit Impulse Signal:


% function[]=get_unit_impulse()
T=exp(-100);
i=1;
p=[];
for t=-1:0.001:1
if t<0
x=0;
elseif (t<=T)
x=(1/T)*t;
else
x=1;
end
p(i)=x;
i=i+1;
end
t=-1:0.001:1;
figure(1),plot(t,p),ylim([0 1.5]);
xlabel("t"),ylabel("Amplitude");
title("Unit Step(Function 1)");

9.
x_diff=diff(p)/T;
t=-1:0.001:1-0.001;
figure(2),plot(t,x_diff);
xlabel("t"),ylabel("Amplitude");
title("Unit Impulse(Function 1)");

Function 2 to Plot Unit Impulse Signal:


T=exp(-100);
t=-5:0.01:5;
x=0.*(t<0)+(1/T).*((t>=0)&(t<=T))+0.*(t>T);
plot(t,x);
xlabel("t"),ylabel("Amplitude");
title("Unit Impulse(Function 2)");

Simulation Results:

10.
11.
12.
13.
14.
Observations:
1) MATLAB plots curves by joining different points of graph due to which graph’s shape gets altered
when zoomed.

2) Tan is discontinuous at nπ/2. To plot tan correctly, we need to adjust the y-limit. [EC 206.1]

3) Exponential function grows or decays much faster for greater value of |a|. [EC 206.1]

4) Plot of real part of complex exponential is similar to cos while that of imaginary part is similar to sin.
[EC 206.1]

5) Heaviside function plots the unit step while dirac delta function is used for unit impulse function.

15.
6) Unit impulse signal can be obtained by differentiating the unit step function. [EC 206.1]

7) Dirac delta function gives infinite value at t=0 which can’t be plotted on graph. [EC 206.1]

Result:
Basic signal waveforms – Sine, Cosine, Tan, Unit Impulse signal, Unit Step signal, Ramp signal,
Exponential signal, Rectangular pulse, Sinc, square pulse, triangular pulse and the complex exponential
signal have been plotted.

16.
Experiment 2
Aim:
Generate and plot a Standard AM/DSB-FC (Amplitude Modulation/Double Side Band with Full Carrier)
modulated signal and its spectrum.

Theory:
Modulation is the process of changing the characteristics (amplitude, frequency or phase) of the carrier
wave in accordance with the message signal. Modulation technique in which amplitude of the carrier
wave is varied in accordance with the instantaneous value of the modulating signal is known as
amplitude modulation.

In conventional amplitude modulation, carrier component is also present in the modulated signal. The
modulated signal is given as,

Where, mn(t) represents the normalized message signal which have minimum value -1. a represents the
modulation index.

After modulation, magnitude and phase of spectrum of message signal gets shifted by fC and φC
respectively which are frequency and phase of the carrier signal.

Modulation index is given by u = Ka*max(Am). If value of modulation index, a is 1 then we obtain perfect
modulation. No distortion of message signal occurs. If value of modulation index is greater than 1, we
obtain over modulation which lead to severe data loss. If value of modulation index is less than 1, we
obtain under modulation.

17.
Simulation Platform:
MATLAB R2021a

Code:
close all;
clear;

A1=1; % Message signal Amplitude


Ac=2; % Carrier signal Amplitude
fm=5; % Message signal frequency

18.
fc=20; % Carrier signal frequency

fs=200; % Sampling frequency


Ts=1/fs; % Sampling time
t=0:Ts:1-Ts;
k=1;

message_signal= A1*cos(2*pi*fm*t); % Message signal


carrier_signal= Ac*cos(2*pi*fc*t); % Carrier signal

figure(1),subplot(2,2,1),plot(t,message_signal);
ylim([-1.5 1.5]),xlabel("Time(sec)"),ylabel("m(t)");
title("Message Signal in Time Domain");

figure(1),subplot(2,2,3),plot(t,carrier_signal);
ylim([-2.5 2.5]),xlabel("Time(sec)"),ylabel("c(t)");
title("Carrier signal in Time Domain");

%Modulated Signal:
modulated_signal_1=(1+k.*message_signal).*carrier_signal;
modulated_signal_2=(1+(k-0.5).*message_signal).*carrier_signal;
modulated_signal_3=(1+(k+0.5).*message_signal).*carrier_signal;

figure(2),subplot(3,2,1),plot(t,modulated_signal_1);
ylim([-5 5]),xlabel("Time(sec)"),ylabel("Amplitude");
title("Modulated Signal in Time domain","(Critical Modulation)");
figure(2),subplot(3,2,3),plot(t,modulated_signal_2);
ylim([-5 5]),xlabel("Time(sec)"),ylabel("Amplitude");
title("Modulated Signal in Time domain","(Under Modulation)");
figure(2),subplot(3,2,5),plot(t,modulated_signal_3);
ylim([-6 6]),xlabel("Time(sec)"),ylabel("Amplitude");
title("Modulated Signal in Time domain","(Over Modulation)");

19.
% To plot the signals in frequency domain
message_signal_ft=fftshift(fft(message_signal));
carrier_signal_ft=fftshift(fft(carrier_signal));
modulated_signal_ft_1=fftshift(fft(modulated_signal_1));
modulated_signal_ft_2=fftshift(fft(modulated_signal_2));
modulated_signal_ft_3=fftshift(fft(modulated_signal_3));
f=linspace(-fs/2,fs/2,length(t));

figure(1),subplot(2,2,2),plot(f,abs(message_signal_ft/length(t)));
ylim([0,1]),xlabel("Frequency(Hz)"),ylabel("m(f)");
title("Message Signal in Frequency Domain");

figure(1),subplot(2,2,4),plot(f,abs(carrier_signal_ft/length(t)));
ylim([0,1.5]),xlabel("Frequency(Hz)"),ylabel("c(f)");
title("Carrier signal in Frequency Domain");

figure(2),subplot(3,2,2),plot(f,abs(modulated_signal_ft_1/length(t)));
ylim([0,1.5]),xlabel("Frequency(Hz)"),ylabel("Amplitude");
title("Modulated Signal in Frequency domain","(Critical Modulation)");

figure(2),subplot(3,2,4),plot(f,abs(modulated_signal_ft_2/length(t)));
ylim([0,1.5]),xlabel("Frequency(Hz)"),ylabel("Amplitude");
title("Modulated Signal in Frequency domain","(Under Modulation)");

figure(2),subplot(3,2,6),plot(f,abs(modulated_signal_ft_3/length(t)));
ylim([0,1.5]),xlabel("Frequency(Hz)"),ylabel("Amplitude");
title("Modulated Signal in Frequency domain","(Over Modulation)");

%Modulated Signal Using Function:


modulated_signal_1f=modulate(message_signal,200,1000,"am");
modulated_signal_1ff=fftshift(fft(modulated_signal_1f));
figure(3),subplot(1,2,1),plot(t,modulated_signal_1f);
ylim([-1.5 1.5]),xlabel("Time(sec)"),ylabel("Amplitude");
title("Modulated Signal in Time domain","(Using Function)");
figure(3),subplot(1,2,2),plot(f,abs(modulated_signal_1ff/length(t)));
ylim([0,1.5]),xlabel("Frequency(Hz)"),ylabel("Amplitude");
title("Modulated Signal in Frequency domain","(Using Function)");

20.
Simulation Results:

21.
Observations:
1) The outputs show amplitude modulated signals for different modulation index values. [EC 206.1], [EC
206.2]

2) Correct graph is obtained when we take fs>=2*fc.

3) To plot frequency spectrum of the signal, we use fft() function which takes discrete Fourier Transform
of the signal. fftshift() rearranges the obtained vector around a central value such that we get a
symmetric vector.

4) Carrier component is also transmitted in conventional AM due to which power required is higher.
[EC 206.2]

5) Amplitude of modulated signal in frequency domain, obtained using fft() is greater than expected.

22.
6) In case of over-modulation, phase reversal occurs whenever signal crosses the x-axis. [EC 206.2]

7) Bandwidth is same as in case of DSB-SC. [EC 206.2]

Result:
MATLAB code for Standard AM/DSB-FC (Amplitude Modulation/Double Side Band with Full Carrier)
modulation has been written and its spectrum has been plotted.

23.
Experiment 3
Aim:
Generate and plot a DSB-SC (Double Side Band Suppressed Carrier) amplitude modulated signal and its
spectrum.

Theory:
Modulation is the process of changing the characteristics (amplitude, frequency or phase) of the carrier
wave in accordance with the message signal. Modulation technique in which amplitude of the carrier
wave is varied in accordance with the instantaneous value of the modulating signal is known as
amplitude modulation.

Double sideband suppressed carrier modulation is a type of amplitude modulation in which message
signal is multiplied directly with the carrier signal.

After modulation, magnitude and phase of spectrum of message signal gets shifted by fC and φC
respectively which are frequency and phase of the carrier signal. Also, spectrum of modulated signal
contains both upper and lower sidebands which results in the name double sideband.

The modulated signal contains no carrier component which results in name suppressed carrier.

Simulation Platform:
MATLAB R2021a

24.
Code:
close all;
clear;

A1=1; % Message signal Amplitude


Ac=2; % Carrier signal Amplitude
fm=5; % Message signal frequency
fc=20; % Carrier signal frequency

fs=200; % Sampling frequency


Ts=1/fs; % Sampling time
t=0:Ts:5/fm;

message_signal= A1*cos(2*pi*fm*t); % Message signal


carrier_signal= Ac*cos(2*pi*fc*t); % Carrier signal

figure(1),subplot(2,2,1),plot(t,message_signal);
axis([0 0.5 -1.5 1.5]),xlabel("Time(sec)"),ylabel("m(t)");
title("Message Signal in Time Domain");

figure(1),subplot(2,2,3),plot(t,carrier_signal);
axis([0 0.5 -2.5 2.5]),xlabel("Time(sec)"),ylabel("c(t)");
title("Carrier signal in Time Domain");

modulated_signal=message_signal.*carrier_signal;
figure(2),subplot(2,2,1),plot(t,modulated_signal);
axis([0 0.5 -2.5 2.5]),xlabel("Time(sec)"),ylabel("Amplitude");
title("Modulated Signal in Time domain");

% To plot the signals in frequency domain


message_signal_ft=fftshift(fft(message_signal));
carrier_signal_ft=fftshift(fft(carrier_signal));
modulated_signal_ft=fftshift(fft(modulated_signal));
f=linspace(-fs/2,fs/2,length(t));

figure(1),subplot(2,2,2),plot(f,abs(message_signal_ft/length(t)));
xlabel("Frequency(Hz)"),ylabel("m(f)");

25.
title("Message Signal in Frequency Domain");

figure(1),subplot(2,2,4),plot(f,abs(carrier_signal_ft/length(t)));
ylim([0 1.5]),xlabel("Frequency(Hz)"),ylabel("c(f)");
title("Carrier signal in Frequency Domain");

figure(2),subplot(2,2,2),plot(f,abs(modulated_signal_ft/length(t)));
xlabel("Frequency(Hz)"),ylabel("Amplitude");
title("Modulated Signal in Frequency domain");

%Using Function:
modulated_signal_f=modulate(message_signal,200,1000,"amdsb-sc");
modulated_signal_ff=fftshift(fft(modulated_signal_f));
figure(2),subplot(2,2,3),plot(t,modulated_signal_f);
axis([0 0.5 -1.5 1.5]),xlabel("Time(sec)"),ylabel("Amplitude");
title("Modulated Signal in Time domain","(Using Function)");
figure(2),subplot(2,2,4),plot(f,abs(modulated_signal_ff/length(t)));
xlabel("Frequency(Hz)"),ylabel("Amplitude");
title("Modulated Signal in Frequency domain","(Using Function)");

Simulation Results:

26.
Observations:
1) The outputs show the DSB-SC modulated signal in both time and frequency domain. [EC 206.1], [EC
206.2]

2) Correct graph is obtained when we take fs>=2*fc.

3) To plot frequency spectrum of the signal, we use fft() function which takes discrete Fourier Transform
of the signal. fftshift() rearranges the obtained vector around a central value such that we get a
symmetric vector.

4) Carrier component is not transmitted in DSB-SC due to which power is saved. [EC 206.2]

5) Amplitude of modulated signal in frequency domain, obtained using fft() is greater than expected.

6) Bandwidth is same as in case of conventional amplitude. [EC 206.2]

Result:
MATLAB code for DSB-SC modulation has been written and its spectrum has been plotted.

27.
Experiment 4
Aim:
Generate and plot a SSB (Single Side Band Suppressed Carrier) amplitude modulated signal and its
spectrum.

Theory:
Modulation is the process of changing the characteristics (amplitude, frequency or phase) of the carrier
wave in accordance with the message signal. Modulation technique in which amplitude of the carrier
wave is varied in accordance with the instantaneous value of the modulating signal is known as
amplitude modulation.

From the two sidebands generated after modulation of signal, only one is sufficient to reconstruct the
message at the receiver end, i.e., one of the sidebands is redundant. Thus, we can reduce the bandwidth
requirement by transmitting just one sideband. This process is known as single sideband suppressed
carrier modulation. A SSB signal is represented as:

Here, represents the Hilbert transform of m(t). The above method of generating a SSB modulated
signal is known as phase discrimination method. In this method, which sideband is selected (upper or
lower) is determined by the sign (+ or -) in the equation of u(t).

Another method of generating SSB modulated signal is the frequency discrimination method. In this
method, we generate a DSB-SC signal and then pass it through a band-pass filter which allows only the
desired frequencies to pass through it while blocking others.

28.
Simulation Platform:
MATLAB R2021a

Code:
%%%%%%%%%%%% Frequency Discrimination Method %%%%%%%%%%%%%
close all;
clear;

A1=1; % Message signal Amplitude


Ac=2; % Carrier signal Amplitude
fm=10; % Message signal frequency
fc=100; % Carrier signal frequency

fs=100*fm; % Sampling frequency


Ts=1/fs; % Sampling time
t=0:Ts:5/fm;

message_signal= A1*cos(2*pi*fm*t); % Message signal


carrier_signal= Ac*cos(2*pi*fc*t); % Carrier signal

% Plotting message and carrier signal


figure(1),subplot(2,2,1),plot(t,message_signal);
axis([0 0.5 -1.5 1.5]),xlabel("Time(sec)"),ylabel("m(t)");
title("Message Signal in Time Domain");

figure(1),subplot(2,2,3),plot(t,carrier_signal);
axis([0 0.5 -2.5 2.5]),xlabel("Time(sec)"),ylabel("c(t)");
title("Carrier signal in Time Domain");

%Generating DSB-SC Signal


modulated_signal=message_signal.*carrier_signal;

figure(2),subplot(2,2,1),plot(t,modulated_signal);
axis([0 0.5 -2.5 2.5]),xlabel("Time(sec)"),ylabel("Amplitude");
title("DSB-SC Signal in Time domain");

29.
% Taking Fourier Transform of Signals
message_signal_ft=fftshift(fft(message_signal));
carrier_signal_ft=fftshift(fft(carrier_signal));
modulated_signal_ft=fftshift(fft(modulated_signal));

f=linspace(-fs/2,fs/2,length(t));

% Plotting the signals in frequency domain


figure(1),subplot(2,2,2),plot(f,abs(message_signal_ft)/length(t));
xlabel("Frequency(Hz)"),ylabel("m(f)");
title("Message Signal in Frequency Domain");

figure(1),subplot(2,2,4),plot(f,abs(carrier_signal_ft)/length(t));
ylim([0 1.5]),xlabel("Frequency(Hz)"),ylabel("c(f)");
title("Carrier signal in Frequency Domain");

figure(2),subplot(2,2,2),plot(f,abs(modulated_signal_ft/length(t)));
ylim([0 1]),xlabel("Frequency(Hz)"),ylabel("Amplitude");
title("DSB-SC Signal in Frequency domain");

% Making Filters
% Filter for Upper Sideband
USB = zeros(1,length(f));
for i = 1:1:length(USB)
if((f(i)>(fc)) && (f(i)<(fc+fm)))||((f(i)<(-fc)) && (f(i)>(-fc-fm)))
USB(i) = 1;
end
end

% Filter for Lower Sideband


LSB = zeros(1,length(f));
for i = 1:1:length(LSB)
if((f(i)<(fc)) && (f(i)>(fc-fm)))||((f(i)>(-fc)) && (f(i)<(-fc+fm)))
LSB(i) = 1;
end
end

30.
% Plotting the Filters
figure(2),subplot(2,2,3),plot(f,USB);
ylim([0 1.5]),xlabel("Frequency(Hz)"),ylabel("Amplitude");
title("Upper Side Band Filter");

figure(2),subplot(2,2,4),plot(f,LSB);
ylim([0 1.5]),xlabel("Frequency(Hz)"),ylabel("Amplitude");
title("Lower Side Band Filter");

% Generating the SSB-SC signal


ssb_usb = USB.*modulated_signal_ft;
ssb_lsb = LSB.*abs(modulated_signal_ft);

figure(3),subplot(2,2,1),plot(f,ssb_usb/length(t));
xlabel("Frequency(Hz)"),ylabel("Amplitude");
title("SSB-SC USB");
figure(3),subplot(2,2,3),plot(f,ssb_lsb/length(t));
xlabel("Frequency(Hz)"),ylabel("Amplitude");
title("SSB-SC LSB");

% SSB-SC signal in Time Domain


ssb_usb_td=ifft((ssb_usb));
figure(3),subplot(2,2,2),plot(t,real(ssb_usb_td));
xlabel("Time(sec)"),ylabel("Amplitude");
title("SSB-SC USB Time Domain");

ssb_lsb_td=ifft(ssb_lsb);
figure(3),subplot(2,2,4),plot(t,real(ssb_lsb_td));
xlabel("Time(sec)"),ylabel("Amplitude");
title("SSB-SC LSB Time Domain");

%%%%%%%%%%%% Phase Discrimination Method %%%%%%%%%%%%%

close all;
clear;

A1=1; % Message signal Amplitude


Ac=2; % Carrier signal Amplitude

31.
fm=10; % Message signal frequency
fc=50; % Carrier signal frequency

fs=200*fm; % Sampling frequency


Ts=1/fs; % Sampling time
t=0:Ts:5/fm;

message_signal= A1*cos(2*pi*fm*t); % Message signal


carrier_signal= Ac*cos(2*pi*fc*t); % Carrier signal

% Plotting message and carrier signal


figure(1),subplot(2,2,1),plot(t,message_signal);
axis([0 0.5 -1.5 1.5]),xlabel("Time(sec)"),ylabel("m(t)");
title("Message Signal in Time Domain");

figure(1),subplot(2,2,3),plot(t,carrier_signal);
axis([0 0.5 -2.5 2.5]),xlabel("Time(sec)"),ylabel("c(t)");
title("Carrier signal in Time Domain");

% Generating SSB-SC signal


ssb_lsb=(message_signal.*carrier_signal) +
(Ac*sin(2*pi*fc*t)).*imag(hilbert(message_signal));
ssb_usb=(message_signal.*carrier_signal) -
(Ac*sin(2*pi*fc*t)).*imag(hilbert(message_signal));

% Plotting SSB-SC signal in Time Domain


figure(2),subplot(2,2,1),plot(t,ssb_lsb);
ylim([-2.5,2.5]),xlabel("Time(sec)"),ylabel("Amplitude");
title("SSB-SC LSB in Time domain");

figure(2),subplot(2,2,3),plot(t,ssb_usb);
ylim([-2.5,2.5]),xlabel("Time(sec)"),ylabel("Amplitude");
title("SSB-SC USB in Time domain");

32.
% Taking Fourier Transform of Signals
message_signal_ft=fftshift(fft(message_signal));
carrier_signal_ft=fftshift(fft(carrier_signal));
ssb_lsb_ft=fftshift(fft(ssb_lsb));
ssb_usb_ft=fftshift(fft(ssb_usb));

f=linspace(-fs/2,fs/2,length(t));

% Plotting the signals in frequency domain


figure(1),subplot(2,2,2),plot(f,abs(message_signal_ft)/length(t));
xlabel("Frequency(Hz)"),ylabel("m(f)");
title("Message Signal in Frequency Domain");

figure(1),subplot(2,2,4),plot(f,abs(carrier_signal_ft)/length(t));
ylim([0 1.5]),xlabel("Frequency(Hz)"),ylabel("c(f)");
title("Carrier signal in Frequency Domain");

figure(2),subplot(2,2,2),plot(f,abs(ssb_lsb_ft)/length(t));
axis([-200 200 0 1.5]),xlabel("Frequency(Hz)"),ylabel("Amplitude");
title("SSB-SC LSB in Frequency domain");

figure(2),subplot(2,2,4),plot(f,abs(ssb_usb_ft)/length(t));
axis([-200 200 0 1.5]),xlabel("Frequency(Hz)"),ylabel("Amplitude");
title("SSB-SC USB in Frequency domain");

%%%%%%%%%%% Modulated Signal Using Function %%%%%%%%%%%%

modulated_signal_1f=modulate(message_signal,50,2000,"amssb");
modulated_signal_1ff=fftshift(fft(modulated_signal_1f));

figure(3),subplot(1,2,1),plot(t,modulated_signal_1f);
xlabel("Time(sec)"),ylabel("Amplitude");
title("Modulated Signal in Time domain","(Using Function)");

figure(3),subplot(1,2,2),plot(f,abs(modulated_signal_1ff/length(t)));
ylim([0,1.5]),xlabel("Frequency(Hz)"),ylabel("Amplitude");
title("Modulated Signal in Frequency domain","(Using Function)");

33.
Simulation Results:

Frequency Discrimination Method:

34.
Phase Discrimination Method:

35.
36.
Observations:
1) The outputs show the SSB-SC modulated signal in both time and frequency domain. [EC 206.1], [EC
206.2]

2) Correct graph is obtained when we take fs>=2*fc.

3) To plot frequency spectrum of the signal, we use fft() function which takes discrete Fourier Transform
of the signal. fftshift() rearranges the obtained vector around a central value such that we get a
symmetric vector.

4) In SSB-SC modulation, only a single sideband is transmitted which saves power as well as bandwidth.
[EC 206.2]

5) Only one of the two sidebands is sufficient to reconstruct the original message signal at the receiver
end. [EC 206.2]
6) One of the two sidebands is selected by passing the modulated signal through a band-pass filter. [EC
206.2]

7) Bandwidth required is smaller than AM and DSB-SC. [EC 206.2]

Result:
MATLAB code for SSB-SC modulation has been written and its spectrum has been plotted.

37.
Experiment 5
Aim:
Perform demodulation of a Standard AM signal in the presence of AWGN (Additive White Gaussian
Noise) noise.

Theory:
Modulation is the process of changing the characteristics (amplitude, frequency or phase) of the carrier
wave in accordance with the message signal. Modulation technique in which amplitude of the carrier
wave is varied in accordance with the instantaneous value of the modulating signal is known as
amplitude modulation.

Demodulation is the process of reconstruction of the original message signal from the modulated signal.
It is done at the receiver end. There are various techniques of demodulation of the modulated signal.
Depending on the type of modulation, a particular method is selected. For AM modulated signal, we use
square law demodulator. In this method, we use a non-linear device and a low pass filter. The
modulated signal is given as input to the non-linear device. The output of the non-linear device various
different frequency components which are filtered by the low-pass filter which has cut-off frequency of
fm. Thus, we get our message signal recovered.

Characteristics of non-linear device are given as:

Simulation Platform:
MATLAB R2021a

Code:
close all;
clear;

38.
A1=1; % Message signal Amplitude
Ac=2; % Carrier signal Amplitude
fm=10; % Message signal frequency
fc=50; % Carrier signal frequency

fs=200; % Sampling frequency


Ts=1/fs; % Sampling time
t=0:Ts:1-Ts;
k=1;

message_signal= A1*cos(2*pi*fm*t); % Message signal


carrier_signal= Ac*cos(2*pi*fc*t); % Carrier signal

figure(1),subplot(2,2,1),plot(t,message_signal);
ylim([-1.5 1.5]),xlabel("Time(sec)"),ylabel("m(t)");
title("Message Signal in Time Domain");

figure(1),subplot(2,2,3),plot(t,carrier_signal);
xlabel("Time(sec)"),ylabel("c(t)");
ylim([-2.5 2.5]),title("Carrier signal in Time Domain");

%Modulated Signal:
modulated_signal_1=(1+k.*message_signal).*carrier_signal;
modulated_signal_2=(1+(k-0.5).*message_signal).*carrier_signal;
modulated_signal_3=(1+(k+0.5).*message_signal).*carrier_signal;

figure(2),subplot(3,2,1),plot(t,modulated_signal_1);
ylim([-5 5]),xlabel("Time(sec)"),ylabel("Amplitude");
title("Modulated Signal in Time domain","(Critical Modulation)");
figure(2),subplot(3,2,3),plot(t,modulated_signal_2);
ylim([-5 5]),xlabel("Time(sec)"),ylabel("Amplitude");
title("Modulated Signal in Time domain","(Under Modulation)");

39.
figure(2),subplot(3,2,5),plot(t,modulated_signal_3);
ylim([-6 6]),xlabel("Time(sec)"),ylabel("Amplitude");
title("Modulated Signal in Time domain","(Over Modulation)");

% To plot the signals in frequency domain


message_signal_ft=fftshift(fft(message_signal));
carrier_signal_ft=fftshift(fft(carrier_signal));
modulated_signal_ft_1=fftshift(fft(modulated_signal_1));
modulated_signal_ft_2=fftshift(fft(modulated_signal_2));
modulated_signal_ft_3=fftshift(fft(modulated_signal_3));
f=linspace(-fs/2,fs/2,length(t));

figure(1),subplot(2,2,2),plot(f,abs(message_signal_ft/length(t)));
ylim([0,1]),xlabel("Frequency(Hz)"),ylabel("m(f)");
title("Message Signal in Frequency Domain");

figure(1),subplot(2,2,4),plot(f,abs(carrier_signal_ft/length(t)));
ylim([0,1.5]),xlabel("Frequency(Hz)"),ylabel("c(f)");
title("Carrier signal in Frequency Domain");

figure(2),subplot(3,2,2),plot(f,abs(modulated_signal_ft_1/length(t)));
ylim([0,1.5]),xlabel("Frequency(Hz)"),ylabel("Amplitude");
title("Modulated Signal in Frequency domain","(Critical Modulation)");

figure(2),subplot(3,2,4),plot(f,abs(modulated_signal_ft_2/length(t)));
ylim([0,1.5]),xlabel("Frequency(Hz)"),ylabel("Amplitude");
title("Modulated Signal in Frequency domain","(Under Modulation)");

figure(2),subplot(3,2,6),plot(f,abs(modulated_signal_ft_3/length(t)));
ylim([0,1.5]),xlabel("Frequency(Hz)"),ylabel("Amplitude");
title("Modulated Signal in Frequency domain","(Over Modulation)");

%%%%%%%%%%%%%%%%%%%%%% Demodulation (Critical Modulation) %%%%%%%%%%%%%%%%%%%%


a1 = 1;
a2 = 0.5;

square_law_device_1 = (a1.*modulated_signal_1) +
(a2.*(modulated_signal_1.*modulated_signal_1));

40.
square_law_device_1ft = fftshift(fft(square_law_device_1));

figure(3),subplot(2,2,1),plot(f,abs(square_law_device_1ft/length(t)));
ylim([0 2]),xlabel("Frequency"),ylabel("Amplitude");
title("Square Law Demodulator Output","(Critical Modulation)");

LPF = ones(1,length(modulated_signal_1));

for i = 1:1:length(LPF)
if(f(i)>fm || f(i)<(-fm))
LPF(i) = 0;
end

end

figure(3),subplot(2,2,2),plot(f,LPF);
ylim([0 1.5]),xlabel("Frequency"),ylabel("Amplitude");
title("Low Pass Filter");

demod_signal_1 = square_law_device_1ft.*LPF;
demod_signal_1final = ifft(demod_signal_1);
figure(3),subplot(2,2,3),plot(f,abs(demod_signal_1/length(t)));
ylim([0 2]),xlabel("Frequency"),ylabel("Amplitude");
title("Demodulated Signal (Critical Modulation)","(Frequency Domain)");
figure(3),subplot(2,2,4),plot(t,abs(demod_signal_1final));
xlabel("Time"),ylabel("Amplitude");
title("Demodulated Signal (Critical Modulation)","(Time Domain)");

%%%%%%%%%%%%%%%%%%%%%%%% Demodulation (Under Modulation) %%%%%%%%%%%%%%%%%%%%%%

square_law_device_2 = (a1.*modulated_signal_2) +
(a2.*(modulated_signal_2.*modulated_signal_2));
square_law_device_2ft = fftshift(fft(square_law_device_2));

figure(4),subplot(2,2,1),plot(f,abs(square_law_device_2ft/length(t)));
ylim([0 2]),xlabel("Frequency"),ylabel("Amplitude");
title("Square Law Demodulator Output","(Under Modulation)");

41.
figure(4),subplot(2,2,2),plot(f,LPF);
ylim([0 1.5]),xlabel("Frequency"),ylabel("Amplitude");
title("Low Pass Filter");

demod_signal_2 = square_law_device_2ft.*LPF;
demod_signal_2final = ifft(demod_signal_2);
figure(4),subplot(2,2,3),plot(f,abs(demod_signal_2/length(t)));
ylim([0 2]),xlabel("Frequency"),ylabel("Amplitude");
title("Demodulated Signal (Under Modulation)","(Frequency Domain)");
figure(4),subplot(2,2,4),plot(t,abs(demod_signal_2final));
xlabel("Time"),ylabel("Amplitude");
title("Demodulated Signal (Under Modulation)","(Time Domain)");

%%%%%%%%%%%%%%%%%%%%%%%% Demodulation (Over Modulation) %%%%%%%%%%%%%%%%%%%%%%

square_law_device_3 = (a1.*modulated_signal_3) +
(a2.*(modulated_signal_3.*modulated_signal_3));
square_law_device_3ft = fftshift(fft(square_law_device_3));

figure(5),subplot(2,2,1),plot(f,abs(square_law_device_3ft/length(t)));
ylim([0 3]),xlabel("Frequency"),ylabel("Amplitude");
title("Square Law Demodulator Output","(Over Modulation)");

figure(5),subplot(2,2,2),plot(f,LPF);
ylim([0 1.5]),xlabel("Frequency"),ylabel("Amplitude");
title("Low Pass Filter");

demod_signal_3 = square_law_device_3ft.*LPF;
demod_signal_3final = ifft(demod_signal_3);
figure(5),subplot(2,2,3),plot(f,abs(demod_signal_3/length(t)));
ylim([0 3]),xlabel("Frequency"),ylabel("Amplitude");
title("Demodulated Signal (Over Modulation)","(Frequency Domain)");
figure(5),subplot(2,2,4),plot(t,abs(demod_signal_3final));
xlabel("Time"),ylabel("Amplitude");
title("Demodulated Signal (Over Modulation)","(Time Domain)");

%%%%%%%%%%%%%%%%%%%%% Adding Noise %%%%%%%%%%%%%%%%%%%%%%%%%%

42.
noisy_signal_1 = awgn(modulated_signal_1,10);
noisy_signal_2 = awgn(modulated_signal_2,10);
noisy_signal_3 = awgn(modulated_signal_3,10);

figure(6),subplot(3,2,1),plot(t,noisy_signal_1);
xlabel("Time(sec)"),ylabel("Amplitude");
title("Noisy Signal in Time domain","(Critical Modulation)");
figure(6),subplot(3,2,3),plot(t,noisy_signal_2);
xlabel("Time(sec)"),ylabel("Amplitude");
title("Noisy Signal in Time domain","(Under Modulation)");
figure(6),subplot(3,2,5),plot(t,noisy_signal_3);
xlabel("Time(sec)"),ylabel("Amplitude");
title("Noisy Signal in Time domain","(Over Modulation)");

noisy_signal_1_ft=fftshift(fft(modulated_signal_1));
noisy_signal_2_ft=fftshift(fft(modulated_signal_2));
noisy_signal_3_ft=fftshift(fft(modulated_signal_3));

figure(6),subplot(3,2,2),plot(f,abs(noisy_signal_1_ft/length(t)));
ylim([0,1.5]),xlabel("Frequency(Hz)"),ylabel("Amplitude");
title("Noisy Signal in Frequency domain","(Critical Modulation)");

figure(6),subplot(3,2,4),plot(f,abs(noisy_signal_2_ft/length(t)));
ylim([0,1.5]),xlabel("Frequency(Hz)"),ylabel("Amplitude");
title("Noisy Signal in Frequency domain","(Under Modulation)");

figure(6),subplot(3,2,6),plot(f,abs(noisy_signal_3_ft/length(t)));
ylim([0,1.5]),xlabel("Frequency(Hz)"),ylabel("Amplitude");
title("Noisy Signal in Frequency domain","(Over Modulation)");

%%%%%%%%%%%%%%%%%% Demodulation with Noise (Critical Modulation)%%%%%%%%%%%%%%%%

noisy_square_law_device_1 = (a1.*noisy_signal_1) +
(a2.*(noisy_signal_1.*noisy_signal_1));
noisy_square_law_device_1ft = fftshift(fft(noisy_square_law_device_1));

figure(7),subplot(2,2,1),plot(f,abs(noisy_square_law_device_1ft/length(t)));
ylim([0 2]),xlabel("Frequency"),ylabel("Amplitude");

43.
title("Square Law Demodulator Output","(Critical Modulation) (Noise)");

figure(7),subplot(2,2,2),plot(f,LPF);
ylim([0 1.5]),xlabel("Frequency"),ylabel("Amplitude");
title("Low Pass Filter");

noisy_demod_signal_1 = noisy_square_law_device_1ft.*LPF;
noisy_demod_signal_1final = ifft(noisy_demod_signal_1);
figure(7),subplot(2,2,3),plot(f,abs(noisy_demod_signal_1/length(t)));
ylim([0 2]),xlabel("Frequency"),ylabel("Amplitude");
title("Demodulated Signal (Critical Modulation)","(Frequency Domain) (Noise)");
figure(7),subplot(2,2,4),plot(t,abs(noisy_demod_signal_1final));
xlabel("Time"),ylabel("Amplitude");
title("Demodulated Signal (Critical Modulation)","(Time Domain) (Noise)");

%%%%%%%%%%%%%%%%%%% Demodulation with Noise (Under Modulation) %%%%%%%%%%%%%%%%

noisy_square_law_device_2 = (a1.*noisy_signal_2) +
(a2.*(noisy_signal_2.*noisy_signal_2));
noisy_square_law_device_2ft = fftshift(fft(noisy_square_law_device_2));

figure(8),subplot(2,2,1),plot(f,abs(noisy_square_law_device_2ft/length(t)));
ylim([0 2]),xlabel("Frequency"),ylabel("Amplitude");
title("Square Law Demodulator Output","(Under Modulation) (Noise)");

figure(8),subplot(2,2,2),plot(f,LPF);
ylim([0 1.5]),xlabel("Frequency"),ylabel("Amplitude");
title("Low Pass Filter");

noisy_demod_signal_2 = noisy_square_law_device_2ft.*LPF;
noisy_demod_signal_2final = ifft(noisy_demod_signal_2);
figure(8),subplot(2,2,3),plot(f,abs(noisy_demod_signal_2/length(t)));
ylim([0 2]),xlabel("Frequency"),ylabel("Amplitude");
title("Demodulated Signal (Under Modulation)","(Frequency Domain) (Noise)");
figure(8),subplot(2,2,4),plot(t,abs(noisy_demod_signal_2final));
xlabel("Time"),ylabel("Amplitude");
title("Demodulated Signal (Under Modulation)","(Time Domain) (Noise)");

44.
%%%%%%%%%%%%%%%%%% Demodulation with Noise(Over Modulation) %%%%%%%%%%%%%%%%%%%

noisy_square_law_device_3 = (a1.*noisy_signal_3) +
(a2.*(noisy_signal_3.*noisy_signal_3));
noisy_square_law_device_3ft = fftshift(fft(noisy_square_law_device_3));

figure(9),subplot(2,2,1),plot(f,abs(noisy_square_law_device_3ft/length(t)));
ylim([0 3]),xlabel("Frequency"),ylabel("Amplitude");
title("Square Law Demodulator Output","(Over Modulation) (Noise)");

figure(9),subplot(2,2,2),plot(f,LPF);
ylim([0 1.5]),xlabel("Frequency"),ylabel("Amplitude");
title("Low Pass Filter");

noisy_demod_signal_3 = noisy_square_law_device_3ft.*LPF;
noisy_demod_signal_3final = ifft(noisy_demod_signal_3);
figure(9),subplot(2,2,3),plot(f,abs(noisy_demod_signal_3/length(t)));
ylim([0 3]),xlabel("Frequency"),ylabel("Amplitude");
title("Demodulated Signal (Over Modulation)","(Frequency Domain) (Noise)");
figure(9),subplot(2,2,4),plot(t,abs(noisy_demod_signal_3final));
xlabel("Time"),ylabel("Amplitude");
title("Demodulated Signal (Over Modulation)","(Time Domain) (Noise)");

Simulation Results:

45.
46.
47.
48.
49.
Observations:
1) The outputs show the demodulated AM signal for different values of modulation index and with noise
added. [EC 206.2]

2) To plot frequency spectrum of the signal, we use fft() function which takes discrete Fourier Transform
of the signal. fftshift() rearranges the obtained vector around a central value such that we get a
symmetric vector.

3) If we use envelope detector for demodulation then over modulated is not reconstructed properly. [EC
206.2]

4) In square law demodulator, a non-linear device is used whose output is passed through a low-pass
filter. [EC 206.2]

5) The bandpass filter is made with frequency range -fm to +fm so that only message signal components
can pass through it. [EC 206.2]

6) Noise is added to the modulated signal using the awgn() function.

7) Addition of noise distorts the signal due to which message signal is not reconstructed properly.

50.
Result:
MATLAB code demodulation of AM signal in presence and absence of awgn noise has been written and
its graphs have been plotted.

51.
Experiment 6
Aim:
Generate and plot an FM (Frequency Modulation) modulated signal and its spectrum.

Theory:
In frequency modulation, frequency of the carrier signal is varied in accordance with the message signal.
Frequency modulation is quite non-linear and is thus more complex to implement and analyze. Effective
bandwidth in case of FM is very large compared to the message signal. Ideally it is infinite. FM offers
high degree of noise immunity. Thus, it trades off bandwidth for noise immunity. FM is represented as:

S(t) = Ac*cos(wct + b*sin(wmt))

Where, b is the modulation index given by b = Kf*Am/fm

Kf is the frequency sensitivity of the modulator.

Simulation Platform:
MATLAB R2021a

52.
Code:
close all;
clear;

A1=1; % Message signal Amplitude


Ac=2; % Carrier signal Amplitude
fm=5; % Message signal frequency
fc=10; % Carrier signal frequency

fs=200; % Sampling frequency


Ts=1/fs; % Sampling time
t=0:Ts:1-Ts;

Kf = 8;
beta = (Kf*A1)/fm;

message_signal= A1*cos(2*pi*fm*t); % Message signal


carrier_signal= Ac*cos(2*pi*fc*t); % Carrier signal

figure(1),subplot(3,2,1),plot(t,message_signal);
ylim([-1.5 1.5]),xlabel("Time(sec)"),ylabel("m(t)");
title("Message Signal in Time Domain");

figure(1),subplot(3,2,3),plot(t,carrier_signal);
xlabel("Time(sec)"),ylabel("c(t)");
ylim([-2.5 2.5]),title("Carrier signal in Time Domain");

modulated_signal = Ac*cos((2*pi*fc*t) + (beta*sin(2*pi*fm*t)));

figure(1),subplot(3,2,5),plot(t,modulated_signal);
ylim([-3 3]),xlabel("Time(sec)"),ylabel("c(t)");
title("Modulated Signal in Time Domain");

message_signal_ft=fftshift(fft(message_signal));

53.
carrier_signal_ft=fftshift(fft(carrier_signal));
modulated_signal_ft=fftshift(fft(modulated_signal));
f=linspace(-fs/2,fs/2,length(t));

figure(1),subplot(3,2,2),plot(f,abs(message_signal_ft/length(t)));
ylim([0,1]),xlabel("Frequency(Hz)"),ylabel("m(f)");
title("Message Signal in Frequency Domain");

figure(1),subplot(3,2,4),plot(f,abs(carrier_signal_ft/length(t)));
ylim([0,1.5]),xlabel("Frequency(Hz)"),ylabel("c(f)");
title("Carrier signal in Frequency Domain");

figure(1),subplot(3,2,6),plot(f,abs(modulated_signal_ft/length(t)));
xlabel("Frequency(Hz)"),ylabel("Amplitude");
title("Modulated Signal in Frequency domain");

%%%%%%%%%%% Modulated Signal Using Function %%%%%%%%%%%%

modulated_signal_1f=modulate(message_signal,10,200,"fm");
modulated_signal_1ff=fftshift(fft(modulated_signal_1f));

figure(2),subplot(1,2,1),plot(t,modulated_signal_1f);
ylim([-1.5 1.5]),xlabel("Time(sec)"),ylabel("Amplitude");
title("Modulated Signal in Time domain","(Using Function)");

figure(2),subplot(1,2,2),plot(f,abs(modulated_signal_1ff/length(t)));
ylim([0,0.5]),xlabel("Frequency(Hz)"),ylabel("Amplitude");
title("Modulated Signal in Frequency domain","(Using Function)");

Simulation Results:

54.
Observations:
1) The outputs show the frequency modulated signal in both time and frequency domain. [EC 206.2]

2) To plot frequency spectrum of the signal, we use fft() function which takes discrete Fourier Transform
of the signal. fftshift() rearranges the obtained vector around a central value such that we get a
symmetric vector.

3) Frequency modulation increases the bandwidth required. [EC 206.2]

55.
4) Power required in FM is more than that required in different AM techniques. [EC 206.2]
5) Depending upon the value of modulation index, modulated signal is either narrow band or wide band.
[EC 206.2]

Result:
MATLAB code for FM modulation has been written and its spectrum has been plotted.

56.
Experiment 7
Aim:
Generate and plot a PM (Phase Modulation) modulated signal and its spectrum.

Theory:
In phase modulation, phase of the carrier signal is varied in accordance with the message signal. Like
frequency modulation, phase modulation is also non-linear and is thus complex to implement and
analyze. Effective bandwidth in case of PM is very large compared to the message signal. When phase
modulation is applied, frequency of signal is also changed. PM offers high degree of noise immunity.
Thus, it trades off bandwidth for noise immunity. PM is represented as:

S(t) = Ac*cos(wct + b*cos(wmt))

Where, b is the modulation index given by b = KP*Am


KP is the phase sensitivity of the modulator.

Simulation Platform:
MATLAB R2021a

Code:
close all;

57.
clear;

A1=1; % Message signal Amplitude


Ac=2; % Carrier signal Amplitude
fm=5; % Message signal frequency
fc=10; % Carrier signal frequency

fs=200; % Sampling frequency


Ts=1/fs; % Sampling time
t=0:Ts:1-Ts;
k=1;

Kp = 8;
beta = Kp*A1;

message_signal= A1*cos(2*pi*fm*t); % Message signal


carrier_signal= Ac*cos(2*pi*fc*t); % Carrier signal

figure(1),subplot(3,2,1),plot(t,message_signal);
ylim([-1.5 1.5]),xlabel("Time(sec)"),ylabel("m(t)");
title("Message Signal in Time Domain");

figure(1),subplot(3,2,3),plot(t,carrier_signal);
xlabel("Time(sec)"),ylabel("c(t)");
ylim([-2.5 2.5]),title("Carrier signal in Time Domain");

modulated_signal = Ac*cos((2*pi*fc*t) + (beta*sin(2*pi*fm*t)));

figure(1),subplot(3,2,5),plot(t,modulated_signal);
ylim([-3 3]),xlabel("Time(sec)"),ylabel("c(t)");
title("Modulated Signal in Time Domain");

message_signal_ft=fftshift(fft(message_signal));
carrier_signal_ft=fftshift(fft(carrier_signal));
modulated_signal_ft=fftshift(fft(modulated_signal));

58.
f=linspace(-fs/2,fs/2,length(t));

figure(1),subplot(3,2,2),plot(f,abs(message_signal_ft/length(t)));
ylim([0,1]),xlabel("Frequency(Hz)"),ylabel("m(f)");
title("Message Signal in Frequency Domain");

figure(1),subplot(3,2,4),plot(f,abs(carrier_signal_ft/length(t)));
ylim([0,1.5]),xlabel("Frequency(Hz)"),ylabel("c(f)");
title("Carrier signal in Frequency Domain");

figure(1),subplot(3,2,6),plot(f,abs(modulated_signal_ft/length(t)));
xlabel("Frequency(Hz)"),ylabel("Amplitude");
title("Modulated Signal in Frequency domain");

%%%%%%%%%%% Modulated Signal Using Function %%%%%%%%%%%%

modulated_signal_1f=modulate(message_signal,10,200,"pm");
modulated_signal_1ff=fftshift(fft(modulated_signal_1f));

figure(2),subplot(1,2,1),plot(t,modulated_signal_1f);
ylim([-1.5 1.5]),xlabel("Time(sec)"),ylabel("Amplitude");
title("Modulated Signal in Time domain","(Using Function)");

figure(2),subplot(1,2,2),plot(f,abs(modulated_signal_1ff/length(t)));
ylim([0,0.5]),xlabel("Frequency(Hz)"),ylabel("Amplitude");
title("Modulated Signal in Frequency domain","(Using Function)");

Simulation Results:

59.
60.
Observations:
1) The outputs show the phase modulated signal in both time and frequency domain. [EC 206.2]

2) To plot frequency spectrum of the signal, we use fft() function which takes discrete Fourier Transform
of the signal. fftshift() rearranges the obtained vector around a central value such that we get a
symmetric vector.

3) Phase modulation is very much similar to the frequency modulation. Frequency and phase
modulation together comprise angle modulation. [EC 206.2]

4) Power required in PM is more than that required in different AM techniques. [EC 206.2]

5) Depending upon the value of modulation index, modulated signal is either narrow band or wide band.
[EC 206.2]

Result:
MATLAB code for PM modulation has been written and its spectrum has been plotted.

61.
EXPERIMENT-8
Aim: To perform demodulation of SSB/DSB.
Software used: MATLAB
Theory:
Modulation is the process of changing the characteristics (amplitude, frequency or phase) of the carrier
wave in accordance with the message signal. Modulation technique in which amplitude of the carrier
wave is varied in accordance with the instantaneous value of the modulating signal is known as
amplitude modulation.

Double sideband suppressed carrier modulation is a type of amplitude modulation in which message
signal is multiplied directly with the carrier signal.

After modulation, magnitude and phase of spectrum of message signal gets shifted by fC and φC
respectively which are frequency and phase of the carrier signal. Also, spectrum of modulated signal
contains both upper and lower sidebands which results in the name double sideband.

The modulated signal contains no carrier component which results in name suppressed carrier.

Code:
f=200;
w1=2*pi*10; w2=2*pi*1; t=0:1/f:20;
c=50*cos(w1.*t); m=10*cos(w2.*t); s=m.*c; mh=imag(hilbert(m));
ssb=(m.*cos(w1.*t))-(mh.*sin(w1.*t));
freq=-100:(f/length(s)):100-(f/length(s)); zd=(1/length(s)).*fft(s);
yd=abs(fftshift(zd)); zs=(1/length(ssb)).*fft(ssb); ys=abs(fftshift(zs));
s1=s.*c; z1=(1/length(s1)).*fft(s1); y1=abs(fftshift(z1)); s2=ssb.*c;
z2=(1/length(s2)).*fft(s2); y2=abs(fftshift(z2)); lpf=(freq>=-2).*(freq<=2);
mfd=lpf.*y1;

62.
mfs=lpf.*y2; md=ifft(ifftshift(mfd))*length(mfd);
ms=ifft(ifftshift(mfs))*length(mfs); subplot(3,3,1);
plot(t,m);
axis([0 5 -15 15]);
xlabel('Time (Sec)'); ylabel('Amplitude'); title('Original Message Signal');
subplot(3,3,2);
plot(t,c);
axis([0 5 -60 60]);
xlabel('Time (Sec)'); ylabel('Amplitude'); title('Carrier Signal');
subplot(3,3,3); plot(freq,lpf);
axis([-5 5 0 2]);
xlabel('Frequency (Hz)'); ylabel('Amplitude'); title('Low Pass Filter');
subplot(3,3,4);
plot(t,s);
axis([0 5 -600 600]);
xlabel('Time (Sec)'); ylabel('Amplitude'); title('DSB-SC Signal');
subplot(3,3,5); plot(freq,yd);
axis([-25 25 0 200]);
xlabel('Frequency (Hz)'); ylabel('Amplitude');
title('DSB-SC Frequency Spectrum');

63.
subplot(3,3,6);
plot(t,md);
axis([0 5 -15000 15000]);
xlabel('Time (Sec)'); ylabel('Amplitude');
title('DSB Demodulated Message Signal'); subplot(3,3,7);
plot(t,ssb); axis([0 2 -15 15]);
xlabel('Time (Sec)'); ylabel('Amplitude'); title('SSB-SC Signal');
subplot(3,3,8); plot(freq,ys);
axis([-20 20 0 7]);
xlabel('Frequency (Hz)'); ylabel('Amplitude');
title('SSB-SC Frequency Spectrum'); subplot(3,3,9);
plot(t,ms);
axis([0 5 -400 400]);
xlabel('Time (Sec)'); ylabel('Amplitude');
title('SSB-SC Demodulated Message Signal');

Graphs:

Results: In this experiment we learned about frequency modulation which is helpful


in our further studies and are very helpful for the growth of our knowledge.

64.
EXPERIMENT-9
Aim: To perform demodulation of FM/PM
Software used: MATLAB
Theory: Frequency modulation:Frequency modulation is a method of modulating a
message signal in which the carrier wave's frequency is changed in response to the
modulating signal's instantaneous amplitude while maintaining the phase and
amplitude constant.
Message signal =>m(t) = Am * cos(wm * t)
Carrier signal =>c(t) = Ac * cos(wc * t)

Wm=angular frequency of message signal


Wc=angular frequency of carrier wave
Am=amplitude of the message signal
Ac=amplitude of carrier wave

Modulated signal:
s(t) = Ac * cos((2 *pi * fc * t) + ((Kf * Am)/fm) .* cos(2 * pi *fm *t));

Direct frequency modulation, which involves feeding a message directly into a


voltage-oscillator controller, or indirect frequency modulation, which involves
integrating a message signal to generate a phase-modulated signal, which is then used
to modulate a crystal-controlled oscillator, the result of which is then transmitted
through a frequency multiplier to produce an FM signal.
Frequency spectrum:The
frequency spectrum of an electrical signal is the distribution of
each frequency component's amplitudes and phases as a function of frequency.
Each signal, according to the Fourier theorem, is made up of a series of sinusoidal
signals. The frequency spectrum analysis of these sinusoidal signals involves
examining their amplitude, frequency, and phase. To extract the amplitude,
frequency, and phase parameters, the signal is filtered, digitized, and Fourier
transformed. The signal's amplitude and phase spectrum can then be plotted using
these parameters.

65.
Code:
am = 5;
ac = 2;
fc = 60; fm=5; fs=1000;
df=40; bf=df/fm; t=0:1/fs:2;
m=am*cos(2*pi*fm*t); subplot(4,1,1);
plot(t,m); title('message signal'); xlabel('time'); ylabel('amplitude'); grid
on;
c = ac*cos(2*pi*fc*t); subplot(4,1,2);
plot(t,c); title('carrier signal'); xlabel('time'); ylabel('amplitude'); grid
on;
im = sin(2*pi*fm*t);
fm_signal = ac*cos(2*pi*fc*t+bf.*im); subplot(4,1,3);
plot(t,fm_signal); title('fm signal'); xlabel('time'); ylabel('amplitude'); grid
on;subplot(4,1,4);
dfm = fmdemod(fm_signal,fc,fs,df); plot(t,dfm);title('demodulated signal');
xlabel('time');ylabel('amplitude'); axis([0 2 -1 1]);
grid on;

Graphs:

Results:
Therefore graph of FM demodulation has been obtained

66.
EXPERIMENT-10
Aim:
Software used: MATLAB
Theory:
Code:
clc; clear all; close all;
Am = input("enter amplitude of message signal : ");
Ac = input("enter amplitude of carrier signal : ");
fm = input("enter frequency of message signal( less than fc ) : ");
fc = input("enter frequency of carrier signal : ");
ft = input("enter instantaneous frequency at any given time : ");
% Ka => modulation index
K = 1.380649*10^(-23); %Boltzmann’s constant T = 2*(ft+fm);
Ka = Am/Ac; Pm = Am*Am/2; Pc = Ac*Ac/2;
Pt = Pc*(1+Ka^2/2); PtD = Pc*Ka*Ka/2; PtS = Pc*Ka*Ka/4; Eff = Ka^2/2+Ka^2; Eff1
= 100;
z = Am^2/2;
disp('**BANDWIDTHS***');
disp('Bandwidth of AM modulated wave : '); disp(2*fm);
disp('Bandwidth of DSB-SC modulated wave : '); disp(2*fm);
disp('Bandwidth of SSB-SC modulated wave : '); disp(fm);
disp('Bandwidth of FM modulated wave : '); disp(T);
disp('Bandwidth of Phase modulated wave : '); disp(T);
disp('*******');
disp('***POWER****');
disp('Power of AM modulated wave : '); disp(Pt);
disp('Power of DSB-SC modulated wave : '); disp(PtD);
disp('Power of SSB-SC modulated wave : '); disp(PtS);
disp('Power of FM modulated wave : '); disp(Pc);
disp('Power of Phase modulated wave : '); disp(Pc);
disp('*******');
disp('***EFFICIENCY****'); disp('Efficiency of AM modulated wave : ');

67.
disp(Eff*100);
disp('Efficiency of DSB-SC modulated wave : '); disp(Eff1);
disp('Efficiency of SSB-SC modulated wave : '); disp(Eff1);
disp('Efficiency of FM modulated wave : '); disp(Eff1);
disp('Efficiency of Phase modulated wave : '); disp(Eff1);
disp('*******');
disp('****FIGURE OF MERIT***');
disp('Figure of merit of AM modulated wave : '); disp((Ka^2)*z/(1+(Ka^2)*z));
disp('Figure of meritof DSB-SC modulated wave : ');
disp(1);
disp('Figure of meritof SSB-SC modulated wave : ');
disp(1);
Psnr = Pc*(1+(Ka^2)*Pm); Nsr = K*2*fm; disp('****SNR***');
disp('SNR ratio of AM modulated wave : '); disp(Snr/Nsr);
disp('SNR ratio of DSB-SC modulated wave : '); disp(Snr/Nsr);
disp('SNR ratio of SSB-SC modulated wave : '); disp(Snr/fm);
disp('*******');

68.
69.
Results:

70.

You might also like