Communication Theory-1 project report || Carrier Acquisition in DSB_SC using coastas loop || Matlab code
1. PROJECTBASED LAB REPORT
On
Carrier Acquisition in DSB-SC using Costas Loop
Submitted in partial fulfilment of the
Requirements for the award of degree
Bachelor of Technology
In
Electronics and Communication Engineering
By
B. Ramesh Reddy - 160040074
A. Sanath Kumar - 160040053
B. Purna - 160040124
Under the guidance of
Mr. P. Raghavendra Rao
(Assistant Professor)
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING
KONERU LAKSHMAIAH EDUCATIONAL FOUNDATION
Green Fields, Vaddeswaram, Guntur District
2. CERTIFICATE
This is to certify that the mini project entitled “CarrierAcquisition in DSB-SC
using Costas Loop”, is being submitted by “ A. Sanath Kumar-160040053,
B. Ramesh Reddy-160040074, B. Purna-160040124”in partial fulfillment for
the award of degree of Bachelor of Technology (B. Tech) in Electronics and
Communications Engineering is a record of confide work carried out by them
under our guidance during the academic year 2017-2018and it has been found
worthy of acceptance according to the requirements of the university.
Signature of The Project Guide Signature of Headof Department
Department of ECE
K L E F
3. KONERU LAKSHMAIAH EDUCATIONAL FOUNDATION
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
We hereby declare that this project based lab report entitled” Carrier
Acquisition in DSB-SC using Costas Loop” has been prepared by us in
partial fulfillment of the requirement for the award of degree “BACHELOR OF
TECHNOLOGY IN ELECTRONICS AND COMMUNICATIONS OF ENGINEERING”
during the academic year 2017-2018.
We 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.
DECLARATION
4. Acknowledgement
We are greatly indebted to our KL University that has provided a healthy
environment to drive us to achieve our ambitions and goals. We would like to
express our sincerethanks to our projectinchargeMr. madam for the guidance,
and assistance they have provided in completing this project.
We express our gratitude to Dr. M Venu Gopala Rao sir for providing us with
adequate facilities, ways and means by which we are able to complete this
project.
My sincerethanksto Mr. P. RaghavendraRao sir in the Lab fortheir outstanding
support
throughout the project for the successful completion of the work.
With immense pleasure, we would like to thank the Head of the Department,
Dr. V. S. V. Prabhakar sirfor hisvaluablesuggestionsand guidancefor thetimely
completion of this project.
We are very much glad for having the support given by our principal, K. Subba
Rao sir who inspired us with his words filled with dedication and discipline
towards work.
We believe that “Practical Leads A Man Towards Performance”.
Last but not the least, a special thanks goes to the Parents, staff and classmates
who are helpful either directly or indirectly in completion of the mini project
5. S. No CONTENTS
1 Introduction
2 About Modulation and Demodulation
3 DSB-SC Transmission
4 Project Task1
5 Costas loop for DSB-SC demodulation
6 Project Task2
7 Multi-tone modulation
8 Project Task3
9 Base Band Modulation and Demodulation
10 Project Task4
11 Project Task5
12 Advantages and Disadvantages
13 Conclusion
14 Future Scope
15 References
6. 1.Introduction
The fundamental purpose of an electronic communications system is to transfer
information transmission, reception and processing of information between two or more
locations using electronic circuits. The original source information can be in Analog form, such
as human voice or music, or in digital form, such as binary coded numbers or alphanumeric
codes. Analog signals are time varying voltages or currents that are continuously changing,
such as sine and cosine waves. An Analog signal contains an infinite number of values. Digital
signals are voltages or currents that change in discrete steps or levels. The most common form
of digital signal is binary, which has two levels. All forms of information however must be
converted to electromagnetic energy before being propagated through an electronic
communication system.
There are numerous forms of communication. We have wired communication, wherein
examples are telephone, broadband internet at home, local area networks at office, just to name
a few. We also have wireless communication such as mobile, Wi-Fi, Bluetooth, radio
broadcast, TV broadcast, and many others. It seems that our lives could not function properly
without communication.
About Modulation and Demodulation
To transmit a message signal to a long distance over a communication channel, we need
to modify the message signal into a suitable form for efficient transmission over the channel.
Modification of the message signal is achieved by means of a process is known as modulation.
The transmission channel is best suited for high frequency signal transmission. The
high frequency signals are called carriers. Modulation is a scheme which alters some
characteristics of the high frequency carrier in accordance with the low frequency message
signal called the modulating signal. Modulation is performed in a transmitter by a circuit is
called a modulator. A carrier that has been acted on by an information system is called
modulated signal. Demodulation is a reverse process of modulation and converts the modulated
carrier back to the original signal. Demodulation is performed in a receiver by a circuit called
demodulator.
Need for Modulation: There are various reasons why modulation is necessary in electronic
communication systems: (a) Ease of Radiation / Transmission (b) Multiplexing (c) Reduction
of Noise (d) Narrow banding (e) Channel Matching.
7. Types of Modulation:
Double-sideband suppressed-carrier transmission (DSB-SC) is transmission in
which frequencies produced by Amplitude modulation (AM) are symmetrically spaced above and
belowthe carrierfrequency andthe carrierlevel isreducedtothe lowestpractical level,ideallybeing
completely suppressed.
Inthe DSB-SCmodulation,unlikeinAM,the wave carrierisnottransmitted;thus,muchof the
power is distributed between the sidebands, which implies an increase of the cover in DSB-SC,
comparedto AM, for the same powerused.DSB-SCtransmissionisaspecial 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
physicallytransmitted.Modulationof a sine waveformtransformsa basebandmessage signal intoa
pass band signal.
8. A modulator is a device that performs modulation. A demodulator (sometimes detector) is a device
that performsdemodulation,the inverseof modulation.The aim of Analogmodulationisto transfer
an Analog baseband (or lowpass) signal, for example an audio signal or TV signal, over an Analog
bandpasschannel atadifferentfrequency,forexampleoveralimitedradiofrequencybandoracable
TV network channel. The aim of digital modulationis to transfer a digital bit stream over an Analog
bandpasschannel,forexample overthe publicswitchedtelephone network(where abandpassfilter
limits the frequency range to 300–3400 Hz) or over a limited radio frequency band.
Task1: Consider a single tone modulating signal m(t ) cos1000t , and carrier signal c (t)
cos10
4
t .
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.
MATLAB CODE FOR TASK-1:
clear all;
close all;
clc;
am=1; %Peak Amplitude of Modulating Signal
ac=1; %Peak Amplitude of Carrier Signal
fm=500; %Modulating Signal Frequency
fc=5000; %Carrier Frequency
fs=100000; %Sampling Frequency
ts=1/fs; %Sampling Interval
N=10000; %Number of Samples
t=(-N/2:1:(N/2-1))*ts; %Time Interval
m=am*cos(2*pi*fm*t); %Modulating Signal
c=ac*cos(2*pi*fc*t); %Carrier Signal
st=c.*m; %DSB-SC Signal
% TASK - 1
%Time Domain of all signals
subplot(3,2,1);
plot(t,m, 'red', 'LineWidth',1.5);axis([0 0.005 -2.5 2.5]);
xlabel('Time (seconds)');ylabel('Amplitude');title('Modulating Signal
signal');
grid on;
subplot(3,2,3);
plot(t,c, 'black', 'LineWidth',1.5);axis([0 0.005 -2.5 2.5]);
xlabel('Time (seconds)');ylabel('Amplitude');title('Carrier Signal
signal');
grid on;
subplot(3,2,5);
plot(t,st, 'blue', 'LineWidth',1.5);axis([0 0.005 -2.5 2.5]);
9. xlabel('Time (seconds)');ylabel('Amplitude(Volts)');title('Modulated
signal');
grid on;hold on
%Spectrums of all Signals
f=(-N/2:1:N/2-1)*fs/N;
M=abs((2/N)*fftshift(fft(m)));
C=abs((2/N)*fftshift(fft(c)));
SF=abs((2/N)*fftshift(fft(st)));
subplot(3,2,2);
plot(f,M/max(M), 'black', 'LineWidth',1.5);axis([-2*fc 2*fc -0.1 1.1]);
xlabel('Frequency (Hz)');ylabel('Amplitude');title('Spectrum of Modulating
Signal signal');
grid on;
subplot(3,2,4);
plot(f,C/max(C), 'black', 'LineWidth',1.5);axis([-2*fc 2*fc -0.1 1.1]);
xlabel('Frequency (Hz)');ylabel('Amplitude');title('Spectrum of Carrier
Signal signal');
grid on;
subplot(3,2,6);
plot(f,SF/max(SF), 'black', 'LineWidth',1.5);axis([-2*fc 2*fc -0.1 1.1]);
xlabel('Frequency (Hz)');ylabel('Amplitude(Volts)');title('Spectrum of
Modulated signal');
grid on;
Su=(1/2)*ac*am*cos(2*pi*(fc+fm))*t;
Sl=(1/2)*ac*am*cos(2*pi*(fc-fm))*t;
%Maximum and Minimum amplitudes of the envelope
Amax = ac + am
Amin = ac - am
%Power Calculations
mu=am/ac %Modulation index
Pc=(ac^2)/2 %Carrier Power
Pu=Pc*(mu^2)/4 %USB POWER
Pl=Pc*(mu^2)/4 %LSB POWER
Ps=Pu+Pl %Total Side Band Power
Pt=Pc*(1+((mu^2)/2)) %Total Power of Modulated wave
10. Amax = 2
Amin = 0
mu = 1
Pc = 0.5000
Pu = 0.1250 Pl = 0.1250 Ps = 0.250 Pt = 0.75
Costas loop for DSB-SC demodulation
A Costas loop is a phase-locked loop (PLL) based circuit which is used
for carrierfrequency recovery from suppressed-carriermodulation signals (e.g. double-
sideband suppressedcarriersignals) andphase modulationsignals(e.g. BPSK, QPSK).Itwasinvented
by John P. Costas at General Electricin the 1950s. Its invention was described as having had "a
profound effect on modern digital communications". This loop,and its variations, is much-usedas a
methodof carrier acquisition(andsimultaneousmessage demodulation) incommunicationsystems,
both Analoganddigital.It has the propertyof beingable toderive a carrier fromthe receivedsignal,
even when there is no component at carrier frequency present in that signal (Eg, DSBSC). The
requirement is that the amplitude spectrum of the received signal be symmetrical about the
frequency.
Demodulation
11. Demodulation is extracting the original information-bearing signal from a modulated carrier
wave.These termsare traditionallyusedinconnectionwithradioreceivers,butmanyothersystems
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 whichisusedto carry it througha telephone line,coaxial cable,oroptical 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 receivermerelyhadtodetectthe presence orabsence of the radiosignal,andproduce
a clicksound.The device thatdidthiswascalleda detector.The firstdetectorswere coherers,simple
devicesthatactedasaswitch.The termdetectorstuck,wasusedforothertypesof demodulatorsand
continues to be used to the present day for a demodulator in a radio receiver.
The firsttype of modulationusedtotransmitsoundoverradiowaveswasamplitudemodulation(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
audiosignal,soitcandrive anearphone.Fessendoninventedthe firstAMdemodulatorin1904 called
the electrolyticdetector,consistingof a shortneedle dippingintoacup of dilute acid.The same year
JohnAmbrose Fleminginventedthe FlemingvalveorthermionicdiodewhichcouldalsorectifyanAM
signal.
Task 2: Use the CostasloopforDSB-SCdemodulationasshowninFig.1.ThisCostasloopacquire the
carrier signal using PLL and recover the message signal using synchronous detection technique as
showninFig1.Furtherinvestigate the impactof channel noise indemodulation/receptionof DSB-SC
wave. Now consider a single tone case.
12. 1. Add the noise variance such that the signal to noise ratio (SNR) of noisy DSB-SC modulated
signal is 20 dB.
2. Use noisy upper side frequency band for demodulation purpose. If necessary use band
pass filter.
3. Sketch the noisy DSB-SC modulated signal DSB - SC (t ) + n(t ) and its spectrum.
4. Sketch the demodulated output mˆ(t ) and its spectrum.
5. Find the output SNR and corresponding figure of merit.
6. Repeatthe above steps for SNR= 10 dB, 30dB and40dB and compare.Commentonresults.
MATLAB CODE FOR TASK-2:
clear all; close all; clc;
fc=5000; %%%% carrier frequency
fs=30000; %%%% Sample frequency
N=5000; %%%% Number of samples
Ts=1/fs; %%%% Sampling interval
t=(0:Ts:(N*Ts)- Ts); %%%% Time interval
f=(-N/2:1:N/2-1)*fs/N; %%%% Frequency interval
fm = 500; %%%% Modulating frequency
m = cos(2*pi*fm*t); %%%% Generation of message signal
M= abs((2/N)*fftshift(fft(m))); %%%% Spectrum of Message signal
c = cos(2*pi*fc*t); %%%% Generation of carrier signal
C=abs((2/N)*fftshift(fft(c))); %%%% Spectrum of Carrier signal
st=c.*m; %%%% Representation of the DSBSC
SF=abs((2/N)*fftshift(fft(st))); %%%% Spectrum of the DSBSC Signal
%NOISE ADDED
%DSB-SC signal with 10db noise
y3=awgn(st,10);
figure();
subplot(4,2,1);
plot(t,y3/max(y3), 'black', 'LineWidth',1.5);axis([0 0.005 -1.2 1.2]);
xlabel('Time (seconds)');ylabel('Amplitude');title('s(t) +10dB noise');
grid on;
%Spectrum of DSB-SC 10db noise added
Y3F=abs((2/N)*fftshift(fft(y3)));
subplot(4,2,2);
plot(f,Y3F/max(Y3F), 'black', 'LineWidth',1.5);axis([-2*fc 2*fc -0.1 1.1]);
xlabel('Frequency (Hz)');ylabel('Amplitude(Volts)');title('Spectrum of 10db
Noise Modulated signal');
grid on;
%DSB-SC signal with 20db noise
y4=awgn(st,20);
subplot(4,2,3);
plot(t,y4/max(y4), 'black', 'LineWidth',1.5);axis([0 0.005 -1.2 1.2]);
xlabel('Time (seconds)');ylabel('Amplitude');title('s(t) +20dB noise');
grid on;
%Spectrum of DSB-SC 20db noise added
Y4F=abs((2/N)*fftshift(fft(y4)));
subplot(4,2,4);
plot(f,Y4F/max(Y4F), 'black', 'LineWidth',1.5);axis([-2*fc 2*fc -0.1 1.1]);
xlabel('Frequency (Hz)');ylabel('Amplitude(Volts)');title('Spectrum of 20db
Noise Modulated signal');
grid on;
%DSB-SC signal with 30db noise
y5=awgn(st,30);
subplot(4,2,5);
plot(t,y5/max(y5), 'black', 'LineWidth',1.5);axis([0 0.005 -1.2 1.2]);
xlabel('Time (seconds)');ylabel('Amplitude');title('s(t) +30dB noise');
13. grid on;
%Spectrum of DSB-SC 30db noise added
Y5F=abs((2/N)*fftshift(fft(y5)));
subplot(4,2,6);
plot(f,Y5F/max(Y5F), 'black', 'LineWidth',1.5);axis([-2*fc 2*fc -0.1 1.1]);
xlabel('Frequency (Hz)');ylabel('Amplitude(Volts)');title('Spectrum of 30db
Noise Modulated signal');
grid on;
%DSB-SC signal with 40db noise
y6=awgn(st,40);
subplot(4,2,7);
plot(t,y6/max(y6), 'black', 'LineWidth',1.5);axis([0 0.005 -1.2 1.2]);
xlabel('Time (seconds)');ylabel('Amplitude');title('s(t) +40dB noise');
grid on;
%Spectrum of DSB-SC 40db noise added
Y6F=abs((2/N)*fftshift(fft(y6)));
subplot(4,2,8);
plot(f,Y6F/max(Y6F), 'black', 'LineWidth',1.5);axis([-2*fc 2*fc -0.1 1.1]);
xlabel('Frequency (Hz)');ylabel('Amplitude(Volts)');title('Spectrum of 40db
Noise Modulated signal');
grid on;
%%%%%%DEMODULATION USING COASTAS LOOP%%%%%%%
% DSB-SC signal
% -----------------------------------------------------------------------
% ---------------------------RECEIVER PART-------------------------------
N = length(y6);
t = 0:1:N-1; % Time vector
phi = zeros(1,N); % Phase vector of VCO initialize
s1 = zeros(1,N);
s2 = zeros(1,N);
y1 = zeros(1,N);
y2 = zeros(1,N);
for i = 1:N
if i>1
% The step in which phase is changed is pi*5*10*-5, it can be varied.
phi(i) = phi(i-1) - (5*10^-5)*pi*sign(y1(i-1)*y2(i-1));
end
s1(i) = st(i) * cos(2*pi*fc*t(i)/fs + phi(i));
s2(i) = st(i) * sin(2*pi*fc*t(i)/fs + phi(i));
% -----------------------INTEGRATOR------------------------------------
if i<=100
% If sample index is less than 100 (Tc/Ts) then we sum available previous
% samples
for j=1:i
y1(i) = y1(i) + s1(j);
y2(i) = y2(i) + s2(j);
end
else
% Summing previous 100 (Tc/Ts) values
for j = i-99:i
y1(i) = y1(i) + s1(j);
y2(i) = y2(i) + s2(j);
end
end
%----------------------------------------------------------------------
end
%Time domain of Demodulated signal
figure();
subplot(1,2,1);
plot(t,y1);title('Demodulated signal');axis([0 900 -10 10]);
xlabel('Time');ylabel('Amplitude');
14. %frequency domain of Demodulated signal
Y1F=abs((2/N)*fftshift(fft(y1)));
subplot(1,2,2);
plot(f,Y1F/max(Y1F), 'black', 'LineWidth',1.5);axis([-2*fc 2*fc -0.1 1.1]);
xlabel('Frequency (Hz)');ylabel('Amplitude');title('Spectrum of Demodulated
signal');
grid on;
Multi-tone Modulation:
15. In multi-tone modulation modulating signal consists of more than one frequency
component where as in single-tone modulation modulating signal consists of only one
frequency component.
Task 3:Repeat the above Tasks1-2 for multi tone signal
m(t ) 2cos1000t sin1500t1.5cos 2000t
MATLAB CODE FOR TASK-3
clear all; close all; clc;
fc=5000; %carrier frequency
fs=30000; %Sample frequency
N=5000; %Number of samples
Ts=1/fs; %Sampling interval
t=(0:Ts:(N*Ts)- Ts); %TIME INTERVAL
f=(-N/2:1:N/2-1)*fs/N; %FREQUENCY INTERVAL
am1=2; %Peak Amplitude of Modulating Signal
am2=1.5; %Peak Amplitude of Modulating Signal
ac=1; %Peak Amplitude of Carrier Signal
m = am1.*cos(1000*pi*t)-sin(1500*pi*t)+am2.*cos(2000*pi*t);% Message signal
M=abs((2/N)*fftshift(fft(m))); %%% Spectrum of Message signal
c = ac.*cos(2*pi*fc*t); %%%% Generation of carrier signal
C=abs((2/N)*fftshift(fft(c))); %%%%Spectrum of Carrier signal
st=2.*m.*cos(2*pi*fc*t); %%%%Representation of the DSBSC Signal
SF=abs((2/N)*fftshift(fft(st))); %%%%Spectrum of the DSBSC Signal
figure();
%%%% Message signal
subplot(3,2,1);
plot(t,m/max(m), 'black', 'LineWidth',1.5);axis([0 0.005 -2.5 2.5]);
xlabel('Time (seconds)');ylabel('Amplitude');title('500 Hz message
signal');
grid on;
%%%% Spectrum of Message signal
subplot(3,2,2);
plot(f,abs(M/max(M)),'r','Linewidth',2); axis([-2*fc 2*fc -0.1 1.1]);
xlabel('f'); ylabel('Magnitude|'); title('Spectrum of Message Signal');
grid on
%%%% Carrier signal
subplot(3,2,3);
plot(t,c/max(c), 'b', 'LineWidth',1.5);axis([0 0.005 -2.5 2.5]);
xlabel('Time (seconds)');ylabel('Amplitude');title('Carrier Signal');
grid on;
%%%% Spectrum of Carrier Signal
subplot(3,2,4);
plot(f,abs(C/max(C)),'m','Linewidth',2); axis([-2*fc 2*fc -0.1 1.1]);
xlabel('f'); ylabel('Magnitude|'); title('Spectrum of carrier Signal');
grid on
%%%% DSBSC signal
subplot(3,2,5);
plot(t,st/max(st), 'b', 'LineWidth',1.5);axis([0 0.0051 -1.2 1.2]);
xlabel('Time (seconds)');ylabel('Amplitude');title('DSBSC signal');
grid on;
%%%% Spectrum of DSBSC
subplot(3,2,6);
plot(f,abs(SF/max(SF)),'m','Linewidth',2); axis([-2*fc 2*fc -0.1 1.1]);
xlabel('f'); ylabel('Magnitude|'); title('Spectrum of DSBSC');
grid on
%Power Calculations
16. mu1=am1/ac;
mu2=am2/ac;
mu=sqrt((mu1^2)+(mu2^2)); %Modulation index
Pc=(ac^2)/2 %Carrier Power
Pu=Pc*(mu^2)/4 %USB POWER
Pl=Pc*(mu^2)/4 %LSB POWER
Ps=Pu+Pl %Total Side Band Power
Pt=Pc*(1+((mu^2)/2)); %Total Power of Modulated wave
%NOISE ADDED
%DSB-SC signal with 10db noise
y3=awgn(st,10);
figure();
subplot(4,2,1);
plot(t,y3/max(y3), 'black', 'LineWidth',1.5);axis([0 0.005 -1.2 1.2]);
xlabel('Time (seconds)');ylabel('Amplitude');title('s(t) +10dB noise');
grid on;
%Spectrum of DSB-SC 10db noise added
Y3F=abs((2/N)*fftshift(fft(y3)));
subplot(4,2,2);
plot(f,Y3F/max(Y3F), 'black', 'LineWidth',1.5);axis([-2*fc 2*fc -0.1 1.1]);
xlabel('Frequency (Hz)');ylabel('Amplitude(Volts)');title('Spectrum of 10db
Noise Modulated signal');
grid on;
%DSB-SC signal with 20db noise
y4=awgn(st,20);
subplot(4,2,3);
plot(t,y4/max(y4), 'black', 'LineWidth',1.5);axis([0 0.005 -1.2 1.2]);
xlabel('Time (seconds)');ylabel('Amplitude');title('s(t) +20dB noise');
grid on;
%Spectrum of DSB-SC 20db noise added
Y4F=abs((2/N)*fftshift(fft(y4)));
subplot(4,2,4);
plot(f,Y4F/max(Y4F), 'black', 'LineWidth',1.5);axis([-2*fc 2*fc -0.1 1.1]);
xlabel('Frequency (Hz)');ylabel('Amplitude(Volts)');title('Spectrum of 20db
Noise Modulated signal');
grid on;
%DSB-SC signal with 30db noise
y5=awgn(st,30);
subplot(4,2,5);
plot(t,y5/max(y5), 'black', 'LineWidth',1.5);axis([0 0.005 -1.2 1.2]);
xlabel('Time (seconds)');ylabel('Amplitude');title('s(t) +30dB noise');
grid on;
%Spectrum of DSB-SC 30db noise added
Y5F=abs((2/N)*fftshift(fft(y5)));
subplot(4,2,6);
plot(f,Y5F/max(Y5F), 'black', 'LineWidth',1.5);axis([-2*fc 2*fc -0.1 1.1]);
xlabel('Frequency (Hz)');ylabel('Amplitude(Volts)');title('Spectrum of 30db
Noise Modulated signal');
grid on;
%DSB-SC signal with 40db noise
y6=awgn(st,40);
subplot(4,2,7);
plot(t,y6/max(y6), 'black', 'LineWidth',1.5);axis([0 0.005 -1.2 1.2]);
xlabel('Time (seconds)');ylabel('Amplitude');title('s(t) +40dB noise');
grid on;
%Spectrum of DSB-SC 40db noise added
Y6F=abs((2/N)*fftshift(fft(y6)));
subplot(4,2,8);
plot(f,Y6F/max(Y6F), 'black', 'LineWidth',1.5);axis([-2*fc 2*fc -0.1 1.1]);
xlabel('Frequency (Hz)');ylabel('Amplitude(Volts)');title('Spectrum of 40db
Noise Modulated signal');
17. grid on;
%%%%%%DEMODULATION USING COASTAS LOOP%%%%%%%
% DSB-SC signal
% -----------------------------------------------------------------------
% ---------------------------RECEIVER PART-------------------------------
N = length(y6);
t = 0:1:N-1; % Time vector
phi = zeros(1,N); % Phase vector of VCO initialize
s1 = zeros(1,N);
s2 = zeros(1,N);
y1 = zeros(1,N);
y2 = zeros(1,N);
for i = 1:N
if i>1
% The step in which phase is changed is pi*5*10*-5, it can be varied.
phi(i) = phi(i-1) - (5*10^-5)*pi*sign(y1(i-1)*y2(i-1));
end
s1(i) = st(i) * cos(2*pi*fc*t(i)/fs + phi(i));
s2(i) = st(i) * sin(2*pi*fc*t(i)/fs + phi(i));
% -----------------------INTEGRATOR------------------------------------
if i<=100
% If sample index is less than 100 (Tc/Ts) then we sum available previous
% samples
for j=1:i
y1(i) = y1(i) + s1(j);
y2(i) = y2(i) + s2(j);
end
else
% Summing previous 100 (Tc/Ts) values
for j = i-99:i
y1(i) = y1(i) + s1(j);
y2(i) = y2(i) + s2(j);
end
end
%----------------------------------------------------------------------
end
%Time domain of Demodulated signal
figure();
subplot(1,2,1);
plot(t,y1);title('Demodulated signal');axis([0 1000 -50 50]);
xlabel('Time');ylabel('Amplitude');
%frequency domain of Demodulated signal
Y1F=abs((2/N)*fftshift(fft(y1)));
subplot(1,2,2);
plot(f,Y1F/max(Y1F), 'black', 'LineWidth',1.5);axis([-2*fc 2*fc -0.1 1.1]);
xlabel('Frequency (Hz)');ylabel('Amplitude');title('Spectrum of Demodulated
signal');
grid on;
18.
19. Pc = 0.5000 Pu = 0.7813 mu = 2.5000
Pl = 0.7813 Ps = 1.5625 Pt = 2.0625
Base BandSignal Modulation and Demodulation:
Baseband modulation and demodulation techniques are fundamental to vg voice, video). If we
consider the voice signal then voice signal band is approximately 4kHz. That means voice
signal contains frequencies ranging from 0-4kHz.
What is Modulation? Modulation is basically increasing signal frequency someway. This
means voice base band is 4kHz and uplifting voice signal frequency to let u say, 1900kHz.
Now, question is wny we need to uplift frequency of actual baseband signal? And here radio
transmission basic concept comes into picture.
In very simple way length of antenna used to transmit signal is directly related to signal
wavelength. Wavelength is length of single cycle of signal. And then what is
frequency? Frequency is number of cycles of signal per second, or, inverse of time taken
to complete one cycle. So, what we can deduce here is if frequency of signal is high then wave
length of signal will be short and vice versa.
relation between frequency and wavelength is expressed by,
c = f * λ
where c = velocity of light which is approximately 3×10^8 m/s , f = frequency of signal, and λ
= wavelength of signal.
20. Task4:Generate bandlimited signal for the frequency range 300 to 3400 Hz. Repeat the
above Tasks for this signal.
MATLAB CODE FOR TASK-4
clear all; close all; clc;
fs=30000;
Ts=1/fs;
N=5000;
f=(-N/2:1:N/2-1)*fs/N;
fc=5000;%carrier frequency
fs=30000;%Sample frequency
N=5000;%Number of samples
ac=1;
am1=1;
am2=1;
am3=1;
am4=1;
am5=1;
am6=1;
am7=1;
am8=1;
Ts=1/fs; % Sampling interval
t=(0:Ts:(N*Ts)- Ts);
b=300;
a=3400;
%Unmodulated carrier
c = cos(2*pi*fc*t);
% Message signal
m1=
cos(2*pi*200*t)+cos(2*pi*500*t)+cos(2*pi*700*t)+cos(2*pi*1000*t)+cos(2*pi*1
500*t)+cos(2*pi*2000*t)+cos(2*pi*3000*t)+cos(2*pi*34000*t);
[b,a] = butter(5,fc*2/fs);
m = filtfilt(b,a,m1);
%%% Spectrum of Message signal
M= abs((2/N)*fftshift(fft(m)));
%%%% Generation of carrier signal
c = cos(2*pi*fc*t);
%%% Spectrum of Carrier signal
C= abs((2/N)*fftshift(fft(c)));
figure(1);
%%%% Message signal
subplot(2,2,1);
plot(t,m/max(m), 'black', 'LineWidth',1.5);axis([0 0.005 -1.2 1.2]);
xlabel('Time (seconds)');ylabel('Amplitude');title('message signal');
grid on;
%%%% Spectrum of Message signal
subplot(2,2,2);
plot(f,abs(M/max(M)),'r','Linewidth',2); axis([-8000 8000 -0.001 1.2]);
xlabel('f'); ylabel('Magnitude|'); title('Spectrum of Message Signal');
grid on
%%%% Carrier signal
subplot(2,2,3);
plot(t,c/max(c), 'b', 'LineWidth',1.5);axis([0 0.0051 -1.2 1.2]);
xlabel('Time (seconds)');ylabel('Amplitude');title('Carrier Signal');
grid on;
21. %%%% Spectrum of Carrier Signal
subplot(2,2,4);
plot(f,abs(C/max(C)),'m','Linewidth',2); axis([-8000 8000 -0.01 1.2]);
xlabel('f'); ylabel('Magnitude|'); title('Spectrum of carrier Signal');
grid on
% Representation of the DSBSC Signal
figure();
st=2.*m.*cos(2*pi*fc*t);
SF= abs((2/N)*fftshift(fft(st)));
%%%% DSBSC signal
subplot(1,2,1);
plot(t,st/max(st), 'b', 'LineWidth',1.5);axis([0 0.0051 -1.2 1.2]);
xlabel('Time (seconds)');ylabel('Amplitude');title('DSBSC signal');
grid on;
%%%% Spectrum of DSBSC
subplot(1,2,2);
plot(f,abs(SF/max(SF)),'m','Linewidth',2); axis([-8000 8000 -0.01 1.2]);
xlabel('f'); ylabel('Magnitude|'); title('Spectrum of DSBSC');
grid on
%Power Calculations
mu1=am1/ac;
mu2=am2/ac;
mu3=am3/ac;
mu4=am4/ac;
mu5=am5/ac;
mu6=am6/ac;
mu7=am7/ac;
mu8=am8/ac;
mu=sqrt((mu1^2)+(mu2^2)+(mu3^2)+(mu4^2)+(mu5^2)+(mu6^2)+(mu7^2)+(mu8^2));
%Modulation index
Pc=(ac^2)/2 %Carrier Power
Pu=Pc*(mu^2)/4 %USB POWER
Pl=Pc*(mu^2)/4 %LSB POWER
Ps=Pu+Pl %Total Side Band Power
Pt=Pc*(1+((mu^2)/2)) %Total Power of Modulated wave
%NOISE ADDED
%DSB-SC signal with 10db noise
y3=awgn(st,10);
figure();
subplot(4,2,1);
plot(t,y3/max(y3), 'black', 'LineWidth',1.5);axis([0 0.005 -1.2 1.2]);
xlabel('Time (seconds)');ylabel('Amplitude');title('s(t) +10dB noise');
grid on;
%Spectrum of DSB-SC 10db noise added
Y3F=abs((2/N)*fftshift(fft(y3)));
subplot(4,2,2);
plot(f,Y3F/max(Y3F), 'black', 'LineWidth',1.5);axis([-2*fc 2*fc -0.1 1.1]);
xlabel('Frequency (Hz)');ylabel('Amplitude(Volts)');title('Spectrum of 10db
Noise Modulated signal');
grid on;
%DSB-SC signal with 20db noise
y4=awgn(st,20);
subplot(4,2,3);
plot(t,y4/max(y4), 'black', 'LineWidth',1.5);axis([0 0.005 -1.2 1.2]);
xlabel('Time (seconds)');ylabel('Amplitude');title('s(t) +20dB noise');
grid on;
%Spectrum of DSB-SC 20db noise added
Y4F=abs((2/N)*fftshift(fft(y4)));
subplot(4,2,4);
plot(f,Y4F/max(Y4F), 'black', 'LineWidth',1.5);axis([-2*fc 2*fc -0.1 1.1]);
22. xlabel('Frequency (Hz)');ylabel('Amplitude(Volts)');title('Spectrum of 20db
Noise Modulated signal');
grid on;
%DSB-SC signal with 30db noise
y5=awgn(st,30);
subplot(4,2,5);
plot(t,y5/max(y5), 'black', 'LineWidth',1.5);axis([0 0.005 -1.2 1.2]);
xlabel('Time (seconds)');ylabel('Amplitude');title('s(t) +30dB noise');
grid on;
%Spectrum of DSB-SC 30db noise added
Y5F=abs((2/N)*fftshift(fft(y5)));
subplot(4,2,6);
plot(f,Y5F/max(Y5F), 'black', 'LineWidth',1.5);axis([-2*fc 2*fc -0.1 1.1]);
xlabel('Frequency (Hz)');ylabel('Amplitude(Volts)');title('Spectrum of 30db
Noise Modulated signal');
grid on;
%DSB-SC signal with 40db noise
y6=awgn(st,40);
subplot(4,2,7);
plot(t,y6/max(y6), 'black', 'LineWidth',1.5);axis([0 0.005 -1.2 1.2]);
xlabel('Time (seconds)');ylabel('Amplitude');title('s(t) +40dB noise');
grid on;
%Spectrum of DSB-SC 40db noise added
Y6F=abs((2/N)*fftshift(fft(y6)));
subplot(4,2,8);
plot(f,Y6F/max(Y6F), 'black', 'LineWidth',1.5);axis([-2*fc 2*fc -0.1 1.1]);
xlabel('Frequency (Hz)');ylabel('Amplitude(Volts)');title('Spectrum of 40db
Noise Modulated signal');
grid on;
%%%%%%DEMODULATION USING COASTAS LOOP%%%%%%%
% DSB-SC signal
% -----------------------------------------------------------------------
% ---------------------------RECEIVER PART-------------------------------
N = length(y6);
t = 0:1:N-1; % Time vector
phi = zeros(1,N); % Phase vector of VCO initialize
s1 = zeros(1,N);
s2 = zeros(1,N);
y1 = zeros(1,N);
y2 = zeros(1,N);
for i = 1:N
if i>1
% The step in which phase is changed is pi*5*10*-5, it can be varied.
phi(i) = phi(i-1) - (5*10^-5)*pi*sign(y1(i-1)*y2(i-1));
end
s1(i) = st(i) * cos(2*pi*fc*t(i)/fs + phi(i));
s2(i) = st(i) * sin(2*pi*fc*t(i)/fs + phi(i));
% -----------------------INTEGRATOR------------------------------------
if i<=100
% If sample index is less than 100 (Tc/Ts) then we sum available previous
% samples
for j=1:i
y1(i) = y1(i) + s1(j);
y2(i) = y2(i) + s2(j);
end
else
% Summing previous 100 (Tc/Ts) values
for j = i-99:i
y1(i) = y1(i) + s1(j);
y2(i) = y2(i) + s2(j);
23. end
end
%----------------------------------------------------------------------
end
%Time domain of Demodulated signal
figure();
subplot(1,2,1);
plot(t,y1);title('Demodulated signal');axis([100 300 -100 100]);
xlabel('Time');ylabel('Amplitude');
%frequency domain of Demodulated signal
Y1F=abs((2/N)*fftshift(fft(y1)));
subplot(1,2,2);
plot(f,Y1F/max(Y1F), 'black', 'LineWidth',1.5);axis([-2*fc 2*fc -0.1 1.1]);
xlabel('Frequency (Hz)');ylabel('Amplitude');title('Spectrum of Demodulated
signal');
grid on;
mu = 2.8284 Pc = 0.5000 Pu = 1.0000
Pl = 1.0000 Ps = 2.0000 Pt = 2.5000
24. Task5:Repeat above tasks for real speech signals.
MATLAB CODE FOR TASK-5
clear all; close all; clc;
fc=5000; %carrier frequency
fs=30000; %Sample frequency
N=5000; %Number of samples
Ts=1/fs; %Sampling interval
t=(0:Ts:(N*Ts)- Ts); %TIME INTERVAL
f=(-N/2:1:N/2-1)*fs/N; %FREQUENCY INTERVAL
ac=1; %Peak Amplitude of Carrier Signal
% Speech signal
[m, fs] = audioread('speech.wav');
m = m(35001:40000); m = m';m = m/max(m);
25. M=abs((2/N)*fftshift(fft(m))); %%% Spectrum of Message signal
c = ac.*cos(2*pi*fc*t); %%%% Generation of carrier signal
C=abs((2/N)*fftshift(fft(c))); %%%%Spectrum of Carrier signal
st=2.*m.*cos(2*pi*fc*t); %%%%Representation of the DSBSC Signal
SF=abs((2/N)*fftshift(fft(st))); %%%%Spectrum of the DSBSC Signal
figure();
%%%% Message signal
subplot(3,2,1);
plot(t,m/max(m), 'black', 'LineWidth',1.5);axis([0 0.005 -2.5 2.5]);
xlabel('Time (seconds)');ylabel('Amplitude');title('500 Hz message
signal');
grid on;
%%%% Spectrum of Message signal
subplot(3,2,2);
plot(f,abs(M/max(M)),'r','Linewidth',2); axis([-2*fc 2*fc -0.1 1.1]);
xlabel('f'); ylabel('Magnitude|'); title('Spectrum of Message Signal');
grid on
%%%% Carrier signal
subplot(3,2,3);
plot(t,c/max(c), 'b', 'LineWidth',1.5);axis([0 0.005 -2.5 2.5]);
xlabel('Time (seconds)');ylabel('Amplitude');title('Carrier Signal');
grid on;
%%%% Spectrum of Carrier Signal
subplot(3,2,4);
plot(f,abs(C/max(C)),'m','Linewidth',2); axis([-2*fc 2*fc -0.1 1.1]);
xlabel('f'); ylabel('Magnitude|'); title('Spectrum of carrier Signal');
grid on
%%%% DSBSC signal
subplot(3,2,5);
plot(t,st/max(st), 'b', 'LineWidth',1.5);axis([0 0.0051 -1.2 1.2]);
xlabel('Time (seconds)');ylabel('Amplitude');title('DSBSC signal');
grid on;
%%%% Spectrum of DSBSC
subplot(3,2,6);
plot(f,abs(SF/max(SF)),'m','Linewidth',2); axis([-2*fc 2*fc -0.1 1.1]);
xlabel('f'); ylabel('Magnitude|'); title('Spectrum of DSBSC');
grid on
%Power Calculations
Pc=(ac^2)/2 %Carrier Power
%NOISE ADDED
%DSB-SC signal with 10db noise
y3=awgn(st,10);
figure();
subplot(4,2,1);
plot(t,y3/max(y3), 'black', 'LineWidth',1.5);axis([0 0.005 -1.2 1.2]);
xlabel('Time (seconds)');ylabel('Amplitude');title('s(t) +10dB noise');
grid on;
%Spectrum of DSB-SC 10db noise added
Y3F=abs((2/N)*fftshift(fft(y3)));
subplot(4,2,2);
plot(f,Y3F/max(Y3F), 'black', 'LineWidth',1.5);axis([-2*fc 2*fc -0.1 1.1]);
xlabel('Frequency (Hz)');ylabel('Amplitude(Volts)');title('Spectrum of 10db
Noise Modulated signal');
grid on;
%DSB-SC signal with 20db noise
y4=awgn(st,20);
subplot(4,2,3);
plot(t,y4/max(y4), 'black', 'LineWidth',1.5);axis([0 0.005 -1.2 1.2]);
xlabel('Time (seconds)');ylabel('Amplitude');title('s(t) +20dB noise');
grid on;
%Spectrum of DSB-SC 20db noise added
26. Y4F=abs((2/N)*fftshift(fft(y4)));
subplot(4,2,4);
plot(f,Y4F/max(Y4F), 'black', 'LineWidth',1.5);axis([-2*fc 2*fc -0.1 1.1]);
xlabel('Frequency (Hz)');ylabel('Amplitude(Volts)');title('Spectrum of 20db
Noise Modulated signal');
grid on;
%DSB-SC signal with 30db noise
y5=awgn(st,30);
subplot(4,2,5);
plot(t,y5/max(y5), 'black', 'LineWidth',1.5);axis([0 0.005 -1.2 1.2]);
xlabel('Time (seconds)');ylabel('Amplitude');title('s(t) +30dB noise');
grid on;
%Spectrum of DSB-SC 30db noise added
Y5F=abs((2/N)*fftshift(fft(y5)));
subplot(4,2,6);
plot(f,Y5F/max(Y5F), 'black', 'LineWidth',1.5);axis([-2*fc 2*fc -0.1 1.1]);
xlabel('Frequency (Hz)');ylabel('Amplitude(Volts)');title('Spectrum of 30db
Noise Modulated signal');
grid on;
%DSB-SC signal with 40db noise
y6=awgn(st,40);
subplot(4,2,7);
plot(t,y6/max(y6), 'black', 'LineWidth',1.5);axis([0 0.005 -1.2 1.2]);
xlabel('Time (seconds)');ylabel('Amplitude');title('s(t) +40dB noise');
grid on;
%Spectrum of DSB-SC 40db noise added
Y6F=abs((2/N)*fftshift(fft(y6)));
subplot(4,2,8);
plot(f,Y6F/max(Y6F), 'black', 'LineWidth',1.5);axis([-2*fc 2*fc -0.1 1.1]);
xlabel('Frequency (Hz)');ylabel('Amplitude(Volts)');title('Spectrum of 40db
Noise Modulated signal');
grid on;
%%%%%%DEMODULATION USING COASTAS LOOP%%%%%%%
% DSB-SC signal
% -----------------------------------------------------------------------
% ---------------------------RECEIVER PART-------------------------------
N = length(y6);
t = 0:1:N-1; % Time vector
phi = zeros(1,N); % Phase vector of VCO initialize
s1 = zeros(1,N);
s2 = zeros(1,N);
y1 = zeros(1,N);
y2 = zeros(1,N);
for i = 1:N
if i>1
% The step in which phase is changed is pi*5*10*-5, it can be varied.
phi(i) = phi(i-1) - (5*10^-5)*pi*sign(y1(i-1)*y2(i-1));
end
s1(i) = st(i) * cos(2*pi*fc*t(i)/fs + phi(i));
s2(i) = st(i) * sin(2*pi*fc*t(i)/fs + phi(i));
% -----------------------INTEGRATOR------------------------------------
if i<=100
% If sample index is less than 100 (Tc/Ts) then we sum available previous
% samples
for j=1:i
y1(i) = y1(i) + s1(j);
y2(i) = y2(i) + s2(j);
end
else
% Summing previous 100 (Tc/Ts) values
for j = i-99:i
27. y1(i) = y1(i) + s1(j);
y2(i) = y2(i) + s2(j);
end
end
%----------------------------------------------------------------------
end
%Time domain of Demodulated signal
figure();
subplot(1,2,1);
plot(t,y1);title('Demodulated signal');axis([100 300 -100 100]);
xlabel('Time');ylabel('Amplitude');
%frequency domain of Demodulated signal
Y1F=abs((2/N)*fftshift(fft(y1)));
subplot(1,2,2);
plot(f,Y1F/max(Y1F), 'black', 'LineWidth',1.5);axis([-2*fc 2*fc -0.1 1.1]);
xlabel('Frequency (Hz)');ylabel('Amplitude');title('Spectrum of Demodulated
signal');
grid on;
28. Advantages and Disadvantages
Advantages
The advantages of DSB-SC are that power consumption is nominal
The signal can be contained in four sidebands, and the bandwidth is double the amount
in the signal
The modulation system is simple
The advantage of Costas loop compared to PLL is error voltage.
The error voltage is less in Costas loop, due to this synchronization is performed
effectively.
Disadvantages
29. Disadvantage of using a DSB or SSB signal modulation is that it is difficult to recover
information at the receiver.
Demodulation depends upon the carrier present in the received signal at the receiver.
If the carrier is not present, carrier has to be regenerated at the receiver so a complex
circuitry is required.
The Costas loop is having disadvantages of long settling time and instability.
Conclusion
This project mainly deals with DSB-SC carrier acquisition using costas loop.
A Costas loop is a phase-locked loop (PLL) based circuit which is used
for carrier frequency recovery from suppressed-carrier modulation signals
DSB-SC is basically an amplitude modulation wave without the carrier, therefore
reducing power waste, giving it a 50% efficiency. This is an increase compared to
normal AM transmission (DSB), which has a maximum efficiency of 33.333%, since
2/3 of the power is in the carrier which carries no intelligence, and each sideband carries
the same information. Single Side Band (SSB) Suppressed Carrier is 100% efficient.
Future Scope
The future trend is towards giga bit rate transmission. This necessitates for
demodulators of the ground receive system to process faster and handle the ever-rising
data throughput more efficiently. Different Satellites use different modulation schemes
with variable data rates. In order to cater to the Multi mission /Multi satellite data
reception requirements of a ground station, it is necessary to have greater flexibility and
programmability features embedded in the design of demodulators. The Costas loop
technique is very adaptable in future telecommunication techniques as it can be applied
with FPGAs and Software Defined Radios etc.
REFERENCES
Advanced Electronic Communications Systems by Wayne Tomasi