Вы находитесь на странице: 1из 32

A

Project Based Lab Report


On
DSB-SC modulation and demodulation with phase and
frequency deviations

submitted in partial fulfilment of the Requirements for


the award of the Degree of Bachelor of Technology in
Electronics & Communication Engineering
By
K.SAI KRISHNA 150040356
K. DURGA BHAVANI 150040369
K. SARATH KUMAR 150040370
Under the guidance of Guide Name:
Dr. Designation:
Professor, Dept. of ECE

Dept. of Computer Science


and Engineering K.L. UNIVERSITY
Green fields, Vaddeswaram-522502, Guntur Dist,2015-16

K L University ECE 1
Department of Computer Science & Engineering

K.L. UNIVERSITY
__________________________________________________________________

CERTIFICATE

This is to certify that this project based lab report entitled “ADC
and DAC with squaring of signals” is a bonafide work done by K.SAI
KRISHNA 150040356, K. SARATH KUMAR 150040370 and K.
DURGA BHAVANI 150040369 in partial fulfilment of the
requirement for the award of degree in Bachelor of Technology in
Electronics and Communication Engineering during the academic year
2016-2017.

I also declare that this project based lab report is of our own
effort and it has not been submitted to any other university for the
award of any degree.

Signature of the Project Guide Signature of Course Coordinator

Head Dep. Of ECE

K L University ECE 2
ACKNOWLEDGMENT

My sincere thanks to in the Lab for their outstanding support throughout the

project for the successful completion of the work.

We express our gratitude to Dr. V. SRIKANTH, Head of the Department for

Computer Science & Engineering for providing us with adequate facilities, ways

and means by which we are able to complete this project based work.

We would like to place on record the deep sense of gratitude to the honourable

Vice Chancellor, K L University for providing the necessary facilities to carry the

concluded project based work.

Last but not the least, we thank all Teaching and Non-Teaching Staff of our

department and especially my classmates and my friends for their support in the

completion of our project based work.

Place: KL University

Date:

S. No Name of the Student

1 K.SAI KRISHNA 150040356

2 K. DURGA BHAVANI 150040369

3 K. SARATH KUMAR 150040370

K L University ECE 3
CONTENTS

Content Page No

Abstract 5

Chapter 1: Introduction (Brief theory) 6-7

Chapter 2: Tasks and Their Simulation Results:

(a) Task1: 8-9

(b) Task2: 9-14

(c) Task3: 14-18

(d) Task4: 18-28

Chapter 3: Conclusions and Future Scope 29

List of Figures 29

References 30

K L University ECE 4
ABSTRACT
Objectives:

(a) Generation of a double sideband suppressed carrier (DSB-SC) modulated


signal.

(b) To investigate the phase and frequency deviations (offset errors) in the

demodulation of DSB- SC signals.

(c) Exposure to simulation on modulation/demodulation systems for DSB-SC


using

MATLAB for synthetic & real signals (such as speech).

Task1: Consider a single tone modulating signal m(t )  cos1000t , and carrier
signal with frequency of 5000 Hz.

1. Determine the expression for DSB-SC modulated signal in both time


domain and frequency domain.
2. Sketch the modulating signal m(t ) and its spectrum.
3. Sketch the carrier wave c (t ) and its spectrum.
4. Sketch the DSB-SC modulated signal DSB SC (t) and its spectrum.
5. Identify the USB and LSB spectra.

K L University ECE 5
6. Determine the maximum and minimum amplitudes of the envelope.
7. Find the powers of USB, LSB, total sideband and modulated waves.

Task2: Now consider a multi tone modulating signal

m(t )  2 cos1000t sin1500t + 1.5cos 2000t and repeat the steps (1) to
(7) above from the Task1 .

Task 3: Assume that the demodulation process is shown in Fig.1. The objective is
to study the effect of phase and frequency offset errors in demodulation of DSB-
SC wave. Now consider a single tone case.

1. The phase angle  , denoting the phase difference between c (t ) and m(t ) at
time t= 0, is variable. Derive the expression for the demodulated wave and sketch
for the following values of   0o , 45o ,90o and 135o . Comment on the results.

2. Assume that the local oscillator frequency Fc generated in the demodulation


process is not synchronized with the carrier frequency generated at
transmitter. Let F is an offset frequency deviated from the local oscillator
and is variable. Derive the expression for the demodulated wave and sketch
for the following values of F = 50 Hz, 100 Hz, 300 Hz and 500 Hz.
Comment on the results.

Task 4: Repeat above tasks for real speech signals.

1. INTRODUCTION

K L University ECE 6
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 sidebands, which
implies an increase of the cover in DSB-SC, compared to AM, for the same power
used. DSB-SC transmission is a special case of double-sideband reduced carrier
transmission. It is used for radio data systems.

In electronics and telecommunications, modulation is the process of varying one


or more properties of a periodic waveform, called the carrier signal, with a
modulating signal that typically contains information to In telecommunications,
modulation is the process of conveying a message signal, for example a digital bit
stream or an analog audio signal, inside another signal that can be physically
transmitted. Modulation of a sine waveform transforms a baseband message signal
into a passband signal.

A modulator is a device that performs modulation. A demodulator (sometimes


detector or demod) is a device that performs demodulation, the inverse of
modulation. A modem (from modulator–demodulator) can perform both
operations.

The aim of analog modulation is to transfer an analog baseband (or lowpass)


signal, for example an audio signal or TV signal, over an analog bandpass channel
at a different frequency, for example over a limited radio frequency band or a
cable TV network channel.

K L University ECE 7
The aim of digital modulation is to transfer a digital bit stream over an analog
bandpass channel, for example over the public switched telephone network (where
a bandpass filter limits the frequency range to 300–3400 Hz) or over a limited
radio frequency band.

Demodulation is extracting the original information-bearing signal from a


modulated carrier wave. These terms are traditionally used in connection with
radio receivers, but many other systems use many kinds of demodulators. For
example, in a modem, which is a contraction of the terms modulator/demodulator,
a demodulator is used to extract a serial digital data stream from a carrier signal
which is used to carry it through a telephone line, coaxial cable, or optical fiber.

Demodulation was first used in radio receivers. In the wireless telegraphy radio
systems used during the first 3 decades of radio (1884-1914) the transmitter did
not communicate audio (sound) but transmitted information in the form of pulses
of radio waves that represented text messages in Morse code. Therefore, the
receiver merely had to detect the presence or absence of the radio signal, and
produce a click sound. The device that did this was called a detector. The first
detectors were coherers, simple devices that acted as a switch. The term detector
stuck, was used for other types of demodulators and continues to be used to the
present day for a demodulator in a radio receiver.

The first type of modulation used to transmit sound over radio waves was
amplitude modulation (AM), invented by Reginald Fessendon around 1900. An
AM radio signal can be demodulated by rectifying it, removing the radio
frequency pulses on one side of the carrier, converting it from alternating current
(AC) to a pulsating direct current (DC). The amplitude of the DC varies with the
modulating audio signal, so it can drive an earphone. Fessendon invented the first
AM demodulator in 1904 called the electrolytic detector, consisting of a short
needle dipping into a cup of dilute acid. The same year John Ambrose Fleming
invented the Fleming valve or thermionic diode which could also rectify an AM
signal.

2. Tasks and Their Simulation Results

K L University ECE 8
Task 1: Consider a single tone modulating signal m(t )  cos1000t , and carrier
signal with frequency of 5000 Hz.

1. Determine the expression for DSB-SC modulated signal in both time


domain and frequency domain.
2. Sketch the modulating signal m(t ) and its spectrum.
3. Sketch the carrier wave c (t ) and its spectrum.
4. Sketch the DSB-SC modulated signal DSB SC (t) and its spectrum.
5. Identify the USB and LSB spectra.
6. Determine the maximum and minimum amplitudes of the envelope.
7. Find the powers of USB, LSB, total sideband and modulated waves.

Code:
clear all;close all;clc;
t=-10:0.00001:10;
x=cos(1000*pi*t);
y=cos(pi*2*5000*t);
r=x.*y;
figure();
subplot(3,1,1);
plot(t,x,'r','LineWidth',1.5);
set(gca,'fontsize',14);
xlabel('time ----->','FontSize',14);ylabel('Amplitude ----->','FontSize',14);
title('C.T. Sinusoidal signal cos(1000*pi*t) ','FontSize',14);
axis([-0.03, 0.03,-2.15,2.15]);grid on

subplot(3,1,2);
plot(t,y,'m','LineWidth',1.5);
set(gca,'fontsize',14);
xlabel('time ----->','FontSize',14);ylabel('Amplitude ----->','FontSize',14);
title('C.T. Sinusoidal signal cos(10000*pi*t) ','FontSize',14);
axis([-.003, .003,-2.15, 2.15]);grid on
subplot(3,1,3)
plot(t,r,'b','LineWidth',1.5);
set(gca,'fontsize',14);
xlabel('time ----->','FontSize',14);ylabel('Amplitude ----->','FontSize',14);
title('C.T. Sinusoidal signal r ','FontSize',14);
axis([-0.03, 0.03,-2.15, 2.15]);grid on

K L University ECE 9
0
C.T. Sinusoidal signal cos(1000*pi*t)
2
Amplitude ----->

-2
-0.03 -0.02 -0.01 0 0.01 0.02 0.03
time ----->
C.T. Sinusoidal signal cos(10000*pi*t)
2
Amplitude ----->

-2
-3 -2 -1 0 1 2 3
time -----> -3
x 10
C.T. Sinusoidal signal r
2
Amplitude ----->

-2
-0.03 -0.02 -0.01 0 0.01 0.02 0.03
time ----->

Fig 2.1: Task 1


fs=3000;%Sample frequency
N=1000;%Number of samples
Ts=1/fs; % Sampling interval
t = -(N/2)*Ts:Ts:((N/2)-1)*Ts;
f1 = (-N/2:1:N/2-1)*fs/N;
x=cos(1000*pi*t);
y=cos(pi*2*5000*t);
m=x.*y;
M = (2/N)*fftshift(fft(m));
Ma = abs(M);
Mp = angle(M);
figure();
subplot(3,1,1);
plot(t,m/max(m), 'm', 'LineWidth',2);axis([-0.005 0.005 -1.2 1.2]);
xlabel('Time (seconds)');ylabel('Amplitude');title('500 Hz Sinusoidal signal');
grid on;
%%%% Magnitude Spectrum of signal
subplot(3,1,2);
plot(f1,Ma/max(Ma),'Linewidth',2); axis([-800 800 -0.2 1.2]);
xlabel('frequency'); ylabel('Magnitude|'); title(' Magnitude Spectrum');
grid on;
%%%% Phase Spectrum of signal
subplot(3,1,3);
plot(f1,Mp,'b','Linewidth',2); axis([-800 800 -4 4]);
xlabel('frequency'); ylabel('Phase angle'); title('Phase Spectrum');

K L University ECE 10
grid on;
500 Hz Sinusoidal signal
1
Amplitude 0.5

-0.5

-1
-5 -4 -3 -2 -1 0 1 2 3 4 5
Time (seconds) -3
x 10
Magnitude Spectrum

1
Magnitude|

0.5

-800 -600 -400 -200 0 200 400 600 800


frequency
Phase Spectrum
4

2
Phase angle

-2

-4
-800 -600 -400 -200 0 200 400 600 800
frequency

Fig 2.1: Task 1


N = 1024;
fs = 2048;
ts = 1/fs;
t=(0:N-1)/fs;
fc = 5000; %Carrier frequency
fm1 =500;
Em1 = 1;
m = Em1*cos(2*pi*fm1*t); %Message
mh = Em1*cos((2*pi*fm1*t)-pi/2);%Hilbert transfo message sig
sbu = m.*2.*cos(2*pi*fc*t) - mh.*2.*sin(2*pi*fc*t);
%Expression for USB DSB
sbl = m.*2.*cos(2*pi*fc*t) + mh.*2.*sin(2*pi*fc*t); %Expression for LSB DSB
SBU = 2/N*abs(fft(sbu)); %Fourier Transform of USB DSB
SBL = 2/N*abs(fft(sbl)); %Fourier Transform of LSB DSB

freq = fs * (0 : N/2) / N;

close all;
figure(2)
subplot(221);
plot(10*t(1:200),sbu(1:200),'r');%Time Domain Plot of USB DSB
title('Time Domain Representation === USB');
xlabel('Time'); ylabel('Modulated Signal');
subplot(222)
plot(10*t(1:200),sbl(1:200),'b');%Time Domain Plot of LSB DSB
title('Time Domain Representation === LSB');

K L University ECE 11
xlabel('Time'); ylabel('Modulated Signal');
subplot(223);
plot(freq,SBU(1:N/2+1))
title('Frequency Domain Representation');
xlabel('Frequency(Hz)'); ylabel('Spectral Magnitude');
legend('USB');
subplot(224)
plot(freq,SBL(1:N/2+1)); %Frequency domain plot
title('Frequency Domain Representation');
xlabel('Frequency(Hz)'); ylabel('Spectral Magnitude');
legend('LSB');
figure(4)
plot(freq,SBU(1:N/2+1),freq,SBL(1:N/2+1));
title('Frequency Domain Representation');
xlabel('Frequency(Hz)'); ylabel('Spectral Magnitude');
legend('USB','LSB');

%%%Demodulation:
md=sbu.*cos(2*pi*fc*t);
[b,a]=butter(2,0.1);
mf=filter(b,a,md);
figure(3)
plot(t,mf)
title('Demodulated Signal');
xlabel('Time'); ylabel('Demodulated Signal');
figure(1);
plot(t,m);
title('Time Domain Representation of Orignal Signal');
xlabel('Time'); ylabel('Original Signal');
Time Domain Representation === USB Time Domain Representation === LSB
M odulated S ignal

M odulated S ignal

2 2

1 1

0 0

-1 -1

-2 -2
0 0.5 1 0 0.5 1
Time Time
S pectral M agnitude

S pectral M agnitude

Frequency Domain Representation Frequency Domain Representation


2 3
USB LSB
1.5
2
1
1
0.5

0 0
0 500 1000 1500 0 500 1000 1500
Frequency(Hz) Frequency(Hz)

K L University ECE 12
Frequency Domain Representation
2.5
USB
LSB

2
Spectral Magnitude

1.5

0.5

0
0 200 400 600 800 1000 1200
Frequency(Hz)

Demodulated Signal
0.3

0.25

0.2
Demodulated Signal

0.15

0.1

0.05

-0.05

-0.1

-0.15

-0.2
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
Time

K L University ECE 13
Time Domain Representation of Orignal Signal
1

0.8

0.6

0.4
Original Signal

0.2

-0.2

-0.4

-0.6

-0.8

-1
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
Time

clear all; close all; clc;


fs=30000;%Sample frequency
N=5000;%Number of samples
Ts=1/fs; % Sampling interval
% t = -(N/2)*Ts:Ts:((N/2)-1)*Ts;
t = (-N/2:1:(N/2)-1)*Ts;
fm=500;
%%% Signal generation
m = cos(2*pi*fm*t);
%%% Spectrum of Message signal
f1 = (-N/2:1:N/2-1)*fs/N;
M = (2/N)*fftshift(fft(m));
fc=5000;
%%% Signal generation
c = cos(2*pi*fc*t);
%%% Spectrum of Message signal
f1 = (-N/2:1:N/2-1)*fs/N;
C = (2/N)*fftshift(fft(c));
m1=sin(2*pi*fm*t);
c1=sin(2*pi*fc*t);
s=m.*c+m1.*c1;
%%%Expression for USB SSB
sbu = m.*2.*cos(2*pi*fc*t) -m1.*2.*sin(2*pi*fc*t);
%%%Expression for LSB SSB
sbl = m.*2.*cos(2*pi*fc*t) + m1.*2.*sin(2*pi*fc*t);
z=sbu;
a=hilbert(z);

K L University ECE 14
y=abs(a);
sig_f=abs(fft(y(1:N)',N));
sig_n=sig_f/(norm(sig_f));
freq_s=(0:N-1)/Ts;
z1=sbl;
a1=hilbert(z1);
y1=abs(a1);
sig_f1=abs(fft(y1(1:N)',N));
sig_n1=sig_f1/(norm(sig_f1));
freq_s=(0:N-1)/Ts;

figure()
subplot(2,2,1);
plot(freq_s(2:250),sig_n(2:250));
title('Envelope Detection: USB');
subplot(2,2,2);
plot(freq_s(2:250), sig_f(2:250));
title('max value of USB');

subplot(2,2,3);
plot(freq_s(2:250),sig_n1(2:250));
title('Envelope Detection : LSB');
subplot(2,2,4);
plot(freq_s(2:250), sig_f1(2:250));
title('max value of LSB');

-5
x 10 Envelope Detection : USB max value of USB
9 0.95

0.9
8.5

0.85
8
0.8

7.5
0.75

7 0.7
0 1 2 3 4 5 6 7 8 0 1 2 3 4 5 6 7 8
6 6
x 10 x 10

-15 -11
x 10 Envelope Detection : LSB x 10 max value of LSB
8 8

6 6

4 4

2 2

0 0
0 1 2 3 4 5 6 7 8 0 1 2 3 4 5 6 7 8
6 6
x 10 x 10

clear all; close all; clc;

K L University ECE 15
fs=30000;%Sample frequency
N=5000;%Number of samples
Ts=1/fs; % Sampling interval
t = (-N/2:1:(N/2)-1)*Ts;
fm=500
%%% Signal generation
m = cos(2*pi*fm*t);
%%% Spectrum of Message signal
f1 = (-N/2:1:N/2-1)*fs/N;
M = (2/N)*fftshift(fft(m));
fc=5000
%%% Signal generation
c = cos(2*pi*fc*t);
%%% Spectrum of Message signal
f1 = (-N/2:1:N/2-1)*fs/N;
C = (2/N)*fftshift(fft(c));
m1=sin(2*pi*fm*t);
c1=sin(2*pi*fc*t);
s=m.*c+m1.*c1;
S = (2/N)*fftshift(fft(s));
%Expression for USB DSB
sbu = m.*2.*cos(2*pi*fc*t) -m1.*2.*sin(2*pi*fc*t);
%Expression for LSB DSB
sbl = m.*2.*cos(2*pi*fc*t) + m1.*2.*sin(2*pi*fc*t);
DBU = 2/N*abs(fft(sbu)); %Fourier Transform of USB DSB
DBL = 2/N*abs(fft(sbl)); %Fourier Transform of LSB DSB
P_S= (norm(S)^2)/length(S)
P_USB = (norm(DBU)^2)/length(DBU)
P_LSB = (norm(DBL)^2)/length(DBL)

K L University ECE 16
Task 2: : Now consider a multi tone modulating signal

m(t )  2 cos1000t sin1500t + 1.5cos 2000t and repeat the steps (1) to
(7) above from the Task1 .

Code:
clear all;close all;clc;
t=-10:0.0001:10;
x=2*cos(1000*pi*t)-sin(1500*pi*t)+1.5*cos(2000*pi*t);
y=cos(pi*2*5000*t);
r=x.*y;
figure();
subplot(3,1,1);
plot(t,x,'r','LineWidth',1.5);
set(gca,'fontsize',14);
xlabel('time ----->','FontSize',14);ylabel('Amplitude ----->','FontSize',14);
title('C.T. Sinusoidal signal 2*cos(1000*pi*t)-sin(1500*pi*t)+1.5*cos(2000*pi*t)
','FontSize',14);
axis([-0.03, 0.03,-2.15,2.15]);grid on
subplot(3,1,2);
plot(t,y,'m','LineWidth',1.5);
set(gca,'fontsize',14);
xlabel('time ----->','FontSize',14);ylabel('Amplitude ----->','FontSize',14);
title('C.T. Sinusoidal signal cos(10000*pi*t) ','FontSize',14);
axis([-0.03, 0.03,-2.15, 2.15]);grid on
subplot(3,1,3)
plot(t,r,'b','LineWidth',1.5);
set(gca,'fontsize',14);
xlabel('time ----->','FontSize',14);ylabel('Amplitude ----->','FontSize',14);
title('C.T. Sinusoidal signal r ','FontSize',14);
axis([-0.03, 0.03,-2.15, 2.15]);grid on

K L University ECE 17
C.T. Sinusoidal signal 2*cos(1000*pi*t)-sin(1500*pi*t)+1.5*cos(2000*pi*t)
2

Amplitude -----> 0

-2
-0.03 -0.02 -0.01 0 0.01 0.02 0.03
time ----->
C.T. Sinusoidal signal cos(10000*pi*t)
2
Amplitude ----->

-2
-0.03 -0.02 -0.01 0 0.01 0.02 0.03
time ----->
C.T. Sinusoidal signal r
2
Amplitude ----->

-2
-0.03 -0.02 -0.01 0 0.01 0.02 0.03
time ----->

clear all; close all; clc;


fs=30000;%Sample frequency
N=5000;%Number of samples
Ts=1/fs; % Sampling interval % t = -(N/2)*Ts:Ts:((N/2)-1)*Ts;
t = (-N/2:1:(N/2)-1)*Ts;
%%% Signal generation
m=2*(cos(1000*pi*t)) -sin(1500*pi*t)+ 1.5*(cos(2000*pi*t));
%%% Spectrum of Message signal
f1 = (-N/2:1:N/2-1)*fs/N;
M = (2/N)*fftshift(fft(m));
fc=5000;
c = cos(2*pi*fc*t); %%% Signal generation
%%% Spectrum of Message signal
f1 = (-N/2:1:N/2-1)*fs/N;
C = (2/N)*fftshift(fft(c));
m1=2*(cos(1000*pi*t-(pi/2))) -sin(1500*pi*t-(pi/2))+ 1.5*(cos(2000*pi*t-
(pi/2)));
c1=sin(2*pi*fc*t);
s=m.*c+m1.*c1;
%Expression for USB SSB
sbu = m.*2.*cos(2*pi*fc*t) -m1.*2.*sin(2*pi*fc*t);
%Expression for USB SSB
sbl = m.*2.*cos(2*pi*fc*t) + m1.*2.*sin(2*pi*fc*t);
SBU = 2/N*abs(fft(sbu)); %Fourier Transform of USB DSB
SBL = 2/N*abs(fft(sbl)); %Fourier Transform of LSB DSB
freq = fs * (0 : N/2) / N;
close all;

K L University ECE 18
figure(2)
subplot(221);
plot(10*t(1:200),sbu(1:200),'r');%Time Domain Plot of USB DSB
title('Time Domain Representation === USB');
xlabel('Time'); ylabel('Modulated Signal');
subplot(222)
plot(10*t(1:200),sbl(1:200),'b');%Time Domain Plot of LSB DSB
title('Time Domain Representation === LSB');
xlabel('Time'); ylabel('Modulated Signal');
subplot(223);
plot(freq,SBU(1:N/2+1))
title('Frequency Domain Representation');
xlabel('Frequency(Hz)'); ylabel('Spectral Magnitude');
legend('USB');
subplot(224)
plot(freq,SBL(1:N/2+1));%Frequency domain plot
title('Frequency Domain Representation');
xlabel('Frequency(Hz)'); ylabel('Spectral Magnitude');
legend('LSB');
figure(4)
plot(freq,SBU(1:N/2+1),freq,SBL(1:N/2+1));
title('Frequency Domain Representation');
xlabel('Frequency(Hz)'); ylabel('Spectral Magnitude');
legend('USB','LSB');
Time Domain Representation === USB Time Domain Representation === LSB
10 10

5 5
Modulated Signal
Modulated Signal

0 0

-5 -5

-10 -10
-0.84 -0.83 -0.82 -0.81 -0.8 -0.79 -0.78 -0.77 -0.76 -0.84 -0.83 -0.82 -0.81 -0.8 -0.79 -0.78 -0.77 -0.76
Time Time

Frequency Domain Representation Frequency Domain Representation


3.5 4
USB LSB
3
3
Spectral Magnitude

Spectral Magnitude

2.5

2
2
1.5

1
1
0.5

0 0
0 5000 10000 15000 0 5000 10000 15000
Frequency(Hz) Frequency(Hz)

K L University ECE 19
Frequency Domain Representation
4
USB
3.5 LSB

3
Spectral Magnitude

2.5

1.5

0.5

0
0 5000 10000 15000
Frequency(Hz)

clear all; close all; clc;


fs=30000;%Sample frequency
N=5000;%Number of samples
Ts=1/fs; % Sampling interval
t = (-N/2:1:(N/2)-1)*Ts;
fm=500; %%% Signal generation
m=2*(cos(1000*pi*t)) -sin(1500*pi*t)+ 1.5*(cos(2000*pi*t));
%%% Spectrum of Message signal
f1 = (-N/2:1:N/2-1)*fs/N;
M = (2/N)*fftshift(fft(m));
fc=5000;
c = cos(2*pi*fc*t); %%% Signal generation
%%% Spectrum of Message signal
f1 = (-N/2:1:N/2-1)*fs/N;
C = (2/N)*fftshift(fft(c));
m1=2*(cos(1000*pi*t-(pi/2))) -sin(1500*pi*t-(pi/2))+ 1.5*(cos(2000*pi*t-
(pi/2)));
c1=sin(2*pi*fc*t);
s=m.*c+m1.*c1;

sbu = m.*2.*cos(2*pi*fc*t) -m1.*2.*sin(2*pi*fc*t); %Expression for USB DSB


sbl = m.*2.*cos(2*pi*fc*t) + m1.*2.*sin(2*pi*fc*t); %Expression for LSB DSB

K L University ECE 20
z=sbu;
a=hilbert(z);
y=abs(a);
sig_f=abs(fft(y(1:N)',N));
sig_n=sig_f/(norm(sig_f));
freq_s=(0:N-1)/Ts;
z1=sbl;
a1=hilbert(z1);
y1=abs(a1);
sig_f1=abs(fft(y1(1:N)',N));
sig_n1=sig_f1/(norm(sig_f1));
freq_s=(0:N-1)/Ts;
figure()
subplot(2,1,1);
plot(freq_s(2:250),sig_n(2:250));title('Envelope Detection: USB');
subplot(2,1,2);
plot(freq_s(2:250),sig_n1(2:250));title('Envelope Detection: LSB');

Envelope Detection : USB


0.2

0.15

0.1

0.05

0
0 1 2 3 4 5 6 7 8
6
x 10
Envelope Detection : LSB
0.2

0.15

0.1

0.05

0
0 1 2 3 4 5 6 7 8
6
x 10

K L University ECE 21
N = 1024;
fs = 2048;
ts = 1/fs;
%t = (0:ts:1);
t=(0:N-1)/fs;
fc = 5000; %Carrier frequency !! Limit fc<800 to avoid freqdomain aliasing
fm1 =500;
Em1 = 1;

m = 2*(cos(1000*pi*t)) -sin(1500*pi*t)+ 1.5*(cos(2000*pi*t)); %Message


mh =Em1*cos((2*pi*fm1*t)-pi/2);%Hilbert transf message sign
sbu = m.*2.*cos(2*pi*fc*t) - mh.*2.*sin(2*pi*fc*t); %Expression for USB DSB
sbl = m.*2.*cos(2*pi*fc*t) + mh.*2.*sin(2*pi*fc*t); %Expression for LSB DSB
SBU = 2/N*abs(fft(sbu)); %Fourier Transform of USB DSB
SBL = 2/N*abs(fft(sbl)); %Fourier Transform of LSB DSB
freq = fs * (0 : N/2) / N;
close all;
figure(2)
subplot(221);
plot(10*t(1:200),sbu(1:200),'r');%Time Domain Plot of USB DSB
title('Time Domain Representation === USB');
xlabel('Time'); ylabel('Modulated Signal');
subplot(222)
plot(10*t(1:200),sbl(1:200),'b');%Time Domain Plot of LSB DSB
title('Time Domain Representation === LSB');
xlabel('Time'); ylabel('Modulated Signal');
subplot(223);
plot(freq,SBU(1:N/2+1))
title('Frequency Domain Representation');
xlabel('Frequency(Hz)'); ylabel('Spectral Magnitude');
legend('USB');
subplot(224)
plot(freq,SBL(1:N/2+1)); %Frequency domain plot
title('Frequency Domain Representation');
xlabel('Frequency(Hz)'); ylabel('Spectral Magnitude');
legend('LSB');

figure(4)
plot(freq,SBU(1:N/2+1),freq,SBL(1:N/2+1));
title('Frequency Domain Representation');
xlabel('Frequency(Hz)'); ylabel('Spectral Magnitude');
legend('USB','LSB');

%%%Demodulation:
md=sbu.*cos(2*pi*fc*t);
[b,a]=butter(2,0.1);
mf=filter(b,a,md);

K L University ECE 22
figure(3)
plot(t,mf)
title('Demodulated Signal');
xlabel('Time'); ylabel('Demodulated Signal');

figure(1);
plot(t,m);
title('Time Domain Representation of Orignal Signal');
xlabel('Time'); ylabel('Original Signal');
Time Domain Representation === USB Time Domain Representation === LSB
10 10
Modulated Signal

Modulated Signal
5 5

0 0

-5 -5

-10 -10
0 0.5 1 0 0.5 1
Time Time
Frequency Domain Representation Frequency Domain Representation
3 4
Spectral Magnitude

Spectral Magnitude

USB LSB
3
2
2
1
1

0 0
0 500 1000 1500 0 500 1000 1500
Frequency(Hz) Frequency(Hz)

K L University ECE 23
Frequency Domain Representation
3.5
USB
LSB
3

2.5
Spectral Magnitude

1.5

0.5

0
0 200 400 600 800 1000 1200
Frequency(Hz)

Demodulated Signal
0.7

0.6

0.5

0.4
Demodulated Signal

0.3

0.2

0.1

-0.1

-0.2

-0.3
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
Time

K L University ECE 24
Time Domain Representation of Orignal Signal
4

2
Original Signal

-1

-2

-3
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
Time

Calculate Power
clear all; close all; clc;
fs=30000;%Sample frequency
N=5000;%Number of samples
Ts=1/fs; % Sampling
t = (-N/2:1:(N/2)-1)*Ts;
fm=500
%%% Signal generation
m = 2*(cos(1000*pi*t)) -sin(1500*pi*t)+ 1.5*(cos(2000*pi*t));
%%% Spectrum of Message signal
f1 = (-N/2:1:N/2-1)*fs/N;
M = (2/N)*fftshift(fft(m));
fc=5000
c = cos(2*pi*fc*t); %%% Signal generation
%%% Spectrum of Message signal
f1 = (-N/2:1:N/2-1)*fs/N;
C = (2/N)*fftshift(fft(c));
m1=sin(2*pi*fm*t);
c1=sin(2*pi*fc*t);
s=m.*c+m1.*c1;
S = (2/N)*fftshift(fft(s));
%Expression for USB DSB
sbu = m.*2.*cos(2*pi*fc*t) -m1.*2.*sin(2*pi*fc*t);

K L University ECE 25
%Expression for LSB DSB
sbl = m.*2.*cos(2*pi*fc*t) + m1.*2.*sin(2*pi*fc*t);
DBU = 2/N*abs(fft(sbu)); %Fourier Transform of USB DSB
DBL = 2/N*abs(fft(sbl)); %Fourier Transform of LSB DSB
P_S= (norm(S)^2)/length(S)
P_USB = (norm(DBU)^2)/length(DBU)
P_LSB = (norm(DBL)^2)/length(DBL)

Task 3: Assume that the demodulation process is shown in Fig.1. The objective
is to study the effect of phase and frequency offset errors in demodulation of
DSB-SC wave. Now consider a single tone case.

1. The phase angle  , denoting the phase difference between c (t ) and m(t ) at
time t= 0, is variable. Derive the expression for the demodulated wave and
sketch for the following values of   0o , 45o ,90o and 135o . Comment on the
results.

2. Assume that the local oscillator frequency Fc generated in the demodulation


process is not synchronized with the carrier frequency generated at
transmitter. Let F is an offset frequency deviated from the local oscillator
and is variable. Derive the expression for the demodulated wave and sketch
for the following values of F = 50 Hz, 100 Hz, 300 Hz and 500 Hz.
Comment on the results.

K L University ECE 26
Code:

clear all; close all; clc;


fs=30000;%Sample frequency
N=5000;%Number of samples
Ts=1/fs; % Sampling interval
t = (-N/2:1:(N/2)-1)*Ts;
fm=500;
%%% Signal generation
m = cos(2*pi*fm*t);
%%% Spectrum of Message signal
f1 = (-N/2:1:N/2-1)*fs/N;
M = (2/N)*fftshift(fft(m));
fc=5000;
%%% Signal generation
c = cos(2*pi*fc*t);
%%% Spectrum of Message signal
f1 = (-N/2:1:N/2-1)*fs/N;
C = (2/N)*fftshift(fft(c));
m1=sin(2*pi*fm*t);
c1=sin(2*pi*fc*t);
s=c.*m;

sbu = m.*2.*cos(2*pi*fc*t) -m1.*2.*sin(2*pi*fc*t); %Expression for USB SSB


sbl = m.*2.*cos(2*pi*fc*t) + m1.*2.*sin(2*pi*fc*t); %Expression for LSB SSB
SBU = 2/N*abs(fft(sbu)); %Fourier Transform of USB SSB
SBL = 2/N*abs(fft(sbl)); %Fourier Transform of LSB SSB
md1=sbu.*cos(2*pi*fc*t);
[b,a]=butter(2,0.1);
mf1=filter(b,a,md1);
md2=sbu.*cos(2*pi*fc*t+(pi/4));
[b,a]=butter(2,0.1);
mf2=filter(b,a,md2);
md3=sbu.*cos(2*pi*fc*t+(pi/2));
[b,a]=butter(2,0.1);
mf3=filter(b,a,md3);
md4=sbu.*cos(2*pi*fc*t+(3*pi/4));
[b,a]=butter(2,0.1);
mf4=filter(b,a,md4);
figure();
subplot(3,1,1);
plot(t,m)
title('Time Domain Representation of Orignal Signal');
xlabel('Time'); ylabel('Original Signal');
subplot(3,2,3);
plot(t,mf1);
title('Demodulated Signal phi=0');
xlabel('Time'); ylabel('Demodulated Signal');

K L University ECE 27
subplot(3,2,4);
plot(t,mf2);
title('Demodulated Signal phi=pi/4=45');
xlabel('Time'); ylabel('Demodulated Signal');
subplot(3,2,5);
plot(t,mf3);
title('Demodulated Signal phi=pi/2=90');
xlabel('Time'); ylabel('Demodulated Signal');
subplot(3,2,6);
plot(t,mf4);
title('Demodulated Signal phi=3*pi/4=135');
xlabel('Time'); ylabel('Demodulated Signal');

Time Domain Representation of Orignal Signal


1
Original Signal

-1
-0.1 -0.08 -0.06 -0.04 -0.02 0 0.02 0.04 0.06 0.08 0.1
Time
Demodulated Signal phi=0 Demodulated Signal phi=pi/4=45
Demodulated Signal

Demodulated Signal

1 1

0
0
-1

-2 -1
-0.1 -0.05 0 0.05 0.1 -0.1 -0.05 0 0.05 0.1
Demodulated Signal phi=pi/2=90 Demodulated Signal phi=3*pi/4=135
Time Time
Demodulated Signal

Demodulated Signal

1 1

0 0

-1 -1
-0.1 -0.05 0 0.05 0.1 -0.1 -0.05 0 0.05 0.1
Time Time

K L University ECE 28
clear all; close all; clc;
fs=30000;%Sample frequency
N=5000;%Number of samples
Ts=1/fs; % Sampling interval
t = (-N/2:1:(N/2)-1)*Ts;
fm=500;
m = cos(2*pi*fm*t); %%% Signal generation
%% Spectrum of Message signal
f1 = (-N/2:1:N/2-1)*fs/N;
M = (2/N)*fftshift(fft(m));
fc=5000;
%%% Signal generation
c = cos(2*pi*fc*t);
%%% Spectrum of Message signal
f1 = (-N/2:1:N/2-1)*fs/N;
C = (2/N)*fftshift(fft(c));
m1=sin(2*pi*fm*t);
c1=sin(2*pi*fc*t);
s=m.*c;

sbu = m.*2.*cos(2*pi*fc*t) -m1.*2.*sin(2*pi*fc*t); %Expression for USB DSB


sbl = m.*2.*cos(2*pi*fc*t) + m1.*2.*sin(2*pi*fc*t); %Expression for LSB DSB
SBU = 2/N*abs(fft(sbu)); %Fourier Transform of USB DSB
SBL = 2/N*abs(fft(sbl)); %Fourier Transform of LSB DSB
md1=sbu.*cos(2*pi*(fc+50)*t);
[b,a]=butter(2,0.1);
mf1=filter(b,a,md1);
md2=sbu.*cos(2*pi*(fc+100)*t);
[b,a]=butter(2,0.1);
mf2=filter(b,a,md2);
md3=sbu.*cos(2*pi*(fc+300)*t);
[b,a]=butter(2,0.1);
mf3=filter(b,a,md3);
md4=sbu.*cos(2*pi*(fc+500)*t);
[b,a]=butter(2,0.1);
mf4=filter(b,a,md4);
figure();
subplot(3,1,1);
plot(t,m)
title('Time Domain Representation of Orignal Signal');
xlabel('Time'); ylabel('Original Signal');
subplot(3,2,3);
plot(t,mf1);
title('Demodulated Signal fc=50');
xlabel('Time'); ylabel('Demodulated Signal');
subplot(3,2,4);
plot(t,mf2);

K L University ECE 29
title('Demodulated Signal fc=100');
xlabel('Time'); ylabel('Demodulated Signal');
subplot(3,2,5);
plot(t,mf3);
title('Demodulated Signal fc=300');
xlabel('Time'); ylabel('Demodulated Signal');
subplot(3,2,6);
plot(t,mf4);
title('Demodulated Signal fc=500');
xlabel('Time'); ylabel('Demodulated Signal');

Time Domain Representation of Orignal Signal


1
Original Signal

-1
-0.1 -0.08 -0.06 -0.04 -0.02 0 0.02 0.04 0.06 0.08 0.1
Time
Demodulated Signal fc=50 Demodulated Signal fc=100
2 2
Demodulated Signal

Demodulated Signal

0 0

-2 -2
-0.1 -0.05 0 0.05 0.1 -0.1 -0.05 0 0.05 0.1
Demodulated Signal fc=300 Demodulated Signal fc=500
Time Time
2 1.5
Demodulated Signal

Demodulated Signal

1
0
0.5

-2 0
-0.1 -0.05 0 0.05 0.1 -0.1 -0.05 0 0.05 0.1
Time Time

K L University ECE 30
Task4: Repeat the above tasks for an analog signal xa(t) = 2sin 200π t-
1.2cos800πt for the sampling frequencies (i) Fs =600Hz (ii) Fs =1200Hz.

Code:

3. Conclusions and Future Scope

This project concludes that the output signal does not vary weather we apply the
Fast Fourier transformation to the input signals, and convolute them or weather if
we convolute the signals and then apply Fast Fourier transformation to the signal
obtained.

LIST OF FIGURES

S. No Figure No Page No

1 2.1 9

2 2.2 13

3 2.3 14

4 2.4 18

5 2.5 18

6 2.6 24

7 2.7 25

8 2.8 25

9 2.9 28

10 2.3.0 28

K L University ECE 31
REFERENCES
1.http://ocw.usu.edu/Communication_Systems_I/sampling_sinusoids.pdf

2. www.mathworks.com/

3. “Digital Signal Processing System Level Design using Lab VIEW”, Elsevier.

4. Alan V. Oppenheium, Alan S. Willsky and Ian T. Young, ‘Signals and Systems’,
Prentice hall of India Private Limited, 1994.
5. Andreas Antonious, “Digital Signal Processing, Signals, Systems and Filters”
Mc-Graw Hill,

K L University ECE 32

Вам также может понравиться