0% found this document useful (0 votes)
9 views

Experiment No 4-12

Uploaded by

bhargavaanita91
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)
9 views

Experiment No 4-12

Uploaded by

bhargavaanita91
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/ 35

ELECTRONICS & COMMUNICATION ENGG.

B.Tech – Vth Semester

S.NO LIST OF EXPERIMENTS CO’s

1. Generation and study of random processes. CO1

2. Generation of uniform and normal random variables, and determination of CO1


the mean and variance of the distribution.

3. Generation of a signal and verify its sampling and reconstruction process. CO2

4. Generation and detection of PAM signal. CO2

5. Generation and detection of PCM signal. CO3

6. Generation of Unipolar NRZ, Polar NRZ, Unipolar RZ, and Polar RZ line CO3
codes.
7. Study of the effect of companding on quantization SNR of speech CO3
waveforms.
8. Generation and detection of Delta modulated signal. CO3

9. Generation and detection of ASK, FSK, and PSK signals. CO4

10. Generation and detection of DPSK signals. CO4

11. Generation and detection of Direct Sequence Spread Spectrum (DSSS). CO5

12. Generation and detection of Frequency Hopping Spread Spectrum CO5


(FHSS).

DC LAB MANUAL Page 1


ELECTRONICS & COMMUNICATION ENGG.

EXPERIMENT NO. 4

AIM: Generation and detection of PAM signals.


APPARATUS REQUIRED: PAM trainer Kit, CRO or DSO, Connecting leads.
THEORY:

1) PULSE AMPLITUDE MODULATION


CONNECTION DIAGRAM:

Pulse Amplitude Modulation (PAM) is the simplest pulse modulation scheme. In pulse
amplitude modulation system, the amplitude of a carrier pulse train is varied in accordance with
the instantaneous level of the modulating signal.
This type of modulation is used as the first step in converting an analog signal to a discrete signal
or in cases where it may be difficult to change the frequency or phase of the carrier. In this case
the carrier is a pulse train rather than a sine wave and the spectrum of the carrier consists of several
components at 2np/T where T is the time between pulses. The applet below shows a PAM signal
and how it varies with modulating signal amplitude and frequency. In this case each component of
the carrier's spectrum has become an AM spectrum. Notice that the spectrum contains a component
at the modulating frequency, which makes the PAM signal relatively easy to demodulate. Pulse-
amplitude modulation, acronym PAM, is a form of signal modulation where the message
information is encoded in the amplitude of a series of signal pulses.

DC LAB MANUAL Page 2


ELECTRONICS & COMMUNICATION ENGG.

BLOCK DIAGRAM:

Fig.1 Generation of PAM

Fig.2 Detection of PAM


WAVEFORM:

PROCEDURE:

1. The circuit wiring is done as shown in diagram.


2. A modulating signal input and clock signal is given to the PAM modulator.
3. The amplitude and the time duration of the modulating signal are observed using CRO or
DSO.
4. Finally, the PAM output is observed from the output of PAM modulator stage and the
amplitude and time duration of the PAM wave are noted down.
5. PAM signal is applied to the filter circuit for demodulation process.
6. After demodulation the original signal is recovered.

DC LAB MANUAL Page 3


ELECTRONICS & COMMUNICATION ENGG.

OUTPUT WAVEFORM:

OBSERVATION TABLE:

Input Signal Carrier Signal Modulated Signal Demodulated


Signal
Amp. Freq. Amp. Freq. Amp. Freq. Amp. Freq.

RESULT: Thus, the PAM signal was generated using PAM modulator.

DC LAB MANUAL Page 4


ELECTRONICS & COMMUNICATION ENGG.

EXPERIMENT NO. 5

AIM: Generation and detection of PCM signal.


APPARATUS REQUIRED: PCM trainer Kit, CRO or DSO, Connecting leads.

CONNECTION DIAGRAM:

THEORY:
Pulse code modulation is a process of converting an analog signal into digital. The voice or
any data input is first sampled using a sampler (which is a simple switch) and then quantized.
Quantization is the process of converting a given signal amplitude to an equivalent binary number
with fixed number of bits. This quantization can be either mid-tread or mid-raise and it can be
uniform or non-uniform based on the requirements. For example, in speech signals, the higher
amplitudes will be less frequent than the low amplitudes. So higher amplitudes are given less step
size than the lower amplitudes and thus quantization is performed non-uniformly. After
quantization the signal is digital and the bits are passed through a parallel to the serial converter
and then launched into the channel serially.
At the demodulator the received bits are first converted into parallel frames and each frame
is de-quantized to an equivalent analog value. This analog value is thus equivalent to a sampler
output. This is the demodulated signal.
In the kit this is implemented differently. The analog signal is passed through an ADC
(Analog to Digital Converter) and then the digital codeword is passed through a parallel to serial
converter block. This is modulated PCM. This is taken by the Serial to Parallel converter and then
through a DAC to get the demodulated signal. The clock is given to all these blocks for
synchronization. The input signal can be either DC or AC according to the kit. The waveforms can
be observed on a CRO for DC without problem.

DC LAB MANUAL Page 5


ELECTRONICS & COMMUNICATION ENGG.

BLOCK DIAGRAM:

Fig.1 PCM Transmitter and Receiver

WAVEFORM

PROCEDURE:

1. Power on the PCM kit.


2. Measure the frequency of the sampling clock.
3. Apply the DC voltage as a modulating signal.
4. Connect the DC input to the ADC and measure the voltage.
5. Connect the clock to the timing and control circuit.
6. Note the binary work from the LED display. The serial data through the channel can be
observed in the CRO.
7. Also observe the binary word at the receiver end.
8. Now apply the AC modulating signal at the input.
9. Observe the waveform at the output of DAC.
10. Note the amplitude of the input voltage and the codeword. Also, note the value of
the output voltage. Show the codeword graphically for a DC input.

DC LAB MANUAL Page 6


ELECTRONICS & COMMUNICATION ENGG.

OUTPUT WAVEFORM:

OBSERVATION TABLE:

Input Signal Transmitter Receiver Input Signal Demodulated Signal


Output Signal

Amp. Freq. Amp. Freq. Amp. Freq. Amp. Freq.

RESULT: Thus, the PCM signal was generated using PCM modulator and the message signal
was detected from PCM signal by using PCM demodulator.

DC LAB MANUAL Page 7


ELECTRONICS & COMMUNICATION ENGG.

EXPERIMENT NO. 6
AIM: Generation of Unipolar NRZ, Polar NRZ, Unipolar RZ, and Polar RZ line codes.

APPARATUS REQUIRED: Data encoding Trainer Kit, Power supply, CRO or DSO, Connecting
leads.
Theory:
Data as well as signals that represents data can either be digital or analog. Line coding is
the process of converting digital data to digital signals. By this technique we converts a sequence
of bits to a digital signal. At the sender side digital data are encoded into a digital signal and at the
receiver side the digital data are recreated by decoding the digital signal. The symbol ‘1’ and ‘0’
can be represented in various formats in different levels and waveforms. The selection of
coding technique depends on system band width, system ability to pass dc level information,
error checking facility.
Unipolar Non return to zero (NRZ) – It is unipolar line coding scheme in which positive voltage
defines bit 1 and the zero voltage defines bit 0. Signal does not return to zero at the middle of the
bit thus it is called NRZ.
Polar schemes –
NRZ-L and NRZ-I – These are somewhat similar to unipolar NRZ scheme but here we use two
levels of amplitude (voltages). For NRZ-L(NRZ-Level), the level of the voltage determines the
value of the bit, typically binary 1 maps to logic-level high, and binary 0 maps to logic-level low,
and for NRZ-I(NRZ-Invert), two-level signal has a transition at a boundary if the next bit that we
are going to transmit is a logical 1, and does not have a transition if the next bit that we are going
to transmit is a logical 0. Note – For NRZ-I we are assuming in the example that previous signal
before starting of data set “01001110” was positive. Therefore, there is no transition at the
beginning and first bit “0” in current data set “01001110” is starting from +V.
Return to zero (RZ) – It uses three values positive,negative,and zero. In this scheme signal goes
to 0 in the middle of each bit. Note – The logic we are using here to represent data is that for bit 1
half of the signal is represented by +V and half by zero voltage and for bit 0 half of the signal is
represented by -V and half by zero voltage. Main disadvantage of RZ encoding is that it requires
greater bandwidth. Another problem is the complexity as it uses three levels of voltage. Instead,
it has been replaced by the better-performing Manchester and differential Manchester schemes.
Biphase (Manchester and Differential Manchester ) – Manchester encoding is somewhat
combination of the RZ (transition at the middle of the bit) and NRZ-L schemes. The duration of
the bit is divided into two halves. The voltage remains at one level during the first half and moves
to the other level in the second half. The transition at the middle of the bit provides synchronization.
Differential Manchester is somewhat combination of the RZ and NRZ-I schemes. There is always
a transition at the middle of the bit but the bit values are determined at the beginning of the bit. If
the next bit is 0, there is a transition, if the next bit is 1, there is no transition.
DC LAB MANUAL Page 8
ELECTRONICS & COMMUNICATION ENGG.

WAVEFORM:

Fig. 1 Unipolar NRZ Fig. 2 Polar NRZ

Fig. 3 Polar NRZ Fig. 4 Biphase (Manchester and Differential


Manchester
PROCEDURE:
1. Power on the Data source and data encoding kit.
2. Connect the clock signal to the trainer kit.
3. Connect the output to the DSO channel along with the clock signal.
4. Observe the waveforms with respect to clock on a dual channel CRO, and compare with
the
model graph.
5. Plot the waveforms for different codes.

OBSERVATION:

RESULTS: Thus the different coding techniques were studied and observed for a given binary
data, and their corresponding waveforms plotted.
CONCLUSION:From the above experiment, we conclude that by using these techniques we can
encode our data easily which helps to secure our data.

DC LAB MANUAL Page 9


ELECTRONICS & COMMUNICATION ENGG.

EXPERIMENT NO. 7

AIM: Study of the effect of companding on quantization SNR of speech waveforms

SOFTWARE USED: MATLAB

THEORY:
Companding

In Analog to Digital Convertor (ADC), the quantizer used is uniformly spaced against
amplitude axis. This allows uniform resolution or step size for the entire range of the signal. The
resulting error or quantization noise is also same for all the amplitude levels. While this appears to
be a very logical way of quantizing signal if quantization error / noise is perceived uniformly across
all amplitude levels, there are occasions when it is not actually so. For example, human auditory
system follows what can be related to a logarithmic process in which high amplitude sounds do not
require the same resolution as low amplitude sounds. The human ear is more sensitive to
quantization noise in small amplitude signals than the large ones.
Companding is combination of two terms compressing and expanding. In the context of
quantization, this refers to compressing the higher amplitude signal first through a non-uniform
quantization process and then expanding it to get back the signal. To obtain non-uniform
quantization a two-step process may be followed - first pass the signal through a compressor and
then compress it by a uniform quantizer.
In speech coding, in an attempt to follow the human auditory system A-law and mu-law
companding are used. Both apply logarithmic quantization functions to adjust the bit resolution in
proportion to the level of the input signal. Smaller signals are represented with greater precision or
more data bits and larger signals with less data bits. The result is fewer bits per sample to maintain
an audible signal-to-noise ratio (SNR). Note the term 'audible'. Audible SNR is the perceived SNR
and not actual SNR.

DC LAB MANUAL Page 10


ELECTRONICS & COMMUNICATION ENGG.

For computational ease, A-law and m-law companding match logarithmic curve with a
piece-wise linear approximation. This first sets eight straight-line segments along the curve to
produce a close approximation to the logarithm function. Each segment is known as a chord. Within
each chord, the piece-wise linear approximation is divided into equally size quantization intervals
called steps. The step size between adjacent codewords is doubled in each succeeding chord. Also
encoded is the sign bit for the original integer. The result is an 8-bit logarithmic code composed of
a 1-bit sign bit, a 3-bit chord, and a 4-bit step.

A-Law Compander

A-law is the CCITT recommended companding standard that is used across Europe and rest
of the countries except Japan, Canada and North America. Limiting the linear sample values to 12
magnitude bits, the A-law compression is defined by Equation 1, where A is the compression
parameter (A=87.7 in Europe), and x is the normalized signal to be compressed.

μ-Law compander

The United States and Japan use m-law companding. In that, the linear sample values are
limited to 13 magnitude bits, the m-law compression is defined by Equation 2, where μ is the
compression parameter (μ =255 in the U.S. and Japan) and x is the normalized signal to be
compressed.

DC LAB MANUAL Page 11


ELECTRONICS & COMMUNICATION ENGG.

The companding process for m-law is similar to that of A-law. The major differences are:
(i) μ-law encoders typically operate on linear 13-bit magnitude data, as opposed to 12-bit magnitude
data with A-law, (ii) before chord determination a bias value of 33 is added to the absolute value
of the linear input data to simplify the chord and step calculations, (iii) the definition of the sign bit
is reversed, and (iv) the inversion pattern is applied to all bits in the 8-bit code.

MATLAB CODE:

(a) Companding Mu Law


% Parameters
mu = 255; % ?-law companding parameter (common value is 255)
x = linspace(-1, 1, 1000); % Example input signal normalized between -1 and 1

% ?-law Companding
companded = sign(x) .* log(1 + mu * abs(x)) ./ log(1 + mu);

% ?-law Expansion (Decompanding)


expanded = sign(companded) .* (1/mu) .* ((1 + mu).^abs(companded) - 1);

% Plot Results
figure;
subplot(3, 1, 1);

DC LAB MANUAL Page 12


ELECTRONICS & COMMUNICATION ENGG.

plot(x);
title('Original Signal');
xlabel('Sample Index');
ylabel('Amplitude');

subplot(3, 1, 2);
plot(companded);
title('Companded Signal (Mu-law)');
xlabel('Sample Index');
ylabel('Amplitude');

subplot(3, 1, 3);
plot(expanded);
title('Expanded Signal (Decompanding)');
xlabel('Sample Index');
ylabel('Amplitude');

(b) Companding A-Law


% Parameters
A = 87.6; % A-law companding parameter (common value is 87.6)
x = linspace(-1, 1, 1000); % Example input signal normalized between -1 and 1

% A-law Companding
companded = zeros(size(x));
for i = 1:length(x)
if abs(x(i)) < 1/A
companded(i) = sign(x(i)) * A * abs(x(i)) / (1 + log(A));
else
DC LAB MANUAL Page 13
ELECTRONICS & COMMUNICATION ENGG.

companded(i) = sign(x(i)) * (1 + log(A * abs(x(i)))) / (1 + log(A));


end
end

% A-law Expansion (Decompanding)


expanded = zeros(size(companded));
for i = 1:length(companded)
if abs(companded(i)) < 1/(1 + log(A))
expanded(i) = sign(companded(i)) * abs(companded(i)) * (1 + log(A)) / A;
else
expanded(i) = sign(companded(i)) * exp(abs(companded(i)) * (1 + log(A)) - 1) / A;
end
end

% Plot Results
figure;
subplot(3, 1, 1);
plot(x);
title('Original Signal');
xlabel('Sample Index');
ylabel('Amplitude');

subplot(3, 1, 2);
plot(companded);
title('Companded Signal (A-law)');
xlabel('Sample Index');
ylabel('Amplitude');

DC LAB MANUAL Page 14


ELECTRONICS & COMMUNICATION ENGG.

subplot(3, 1, 3);
plot(expanded);
title('Expanded Signal (Decompanding)');
xlabel('Sample Index');
ylabel('Amplitude');

OUTPUT WAVEFORM:

RESULT: Studied the principle of companding using A law and mu law compander.

DC LAB MANUAL Page 15


ELECTRONICS & COMMUNICATION ENGG.

EXPERIMENT NO. 8
AIM: To study and perform delta modulation and demodulation.

APPARATUS REQUIRED: DM kit, CRO and connecting probes

CONNECTION DIAGRAM:

THEORY:
Delta modulation is the DPCM technique of converting an analog message signal to a digital
sequence. The difference signal between two successive samples is encoded into a single bit code.
The block and kit diagrams show the circuitry details of the modulation technique. A present
sample of the analog signal x(nT) is compared with a previous sample and the difference output
is level shifted, i.e. a positive level (corresponding to bit 1) is given if difference is positive and
negative level (corresponding to bit 0) if it is negative. The comparison of samples is
accomplished by converting the digital to analog form and then comparing with the present
sample. This is done using an Up counter and DAC as shown in block diagram. The delta
modulated signal is given to up counter and then a DAC and the analog input is given to OPAMP
and a LPF to obtain the demodulated output.

DC LAB MANUAL Page 16


ELECTRONICS & COMMUNICATION ENGG.

BLOCK DIAGRAM:

Fig.1 DM signal Generator

Fig.2 Delta Demodulator


PROCEDURE
1. Switch on the kit. Connect the clock signal and the modulating input signal to the modulator
block. Observe the modulated signal in the CRO.
2. Connect the DM output to the demodulator circuit. Observe the demodulator output on the
CRO.
3. Also observe the DAC output on the CRO.
4. Change the amplitude of the modulating signal and observe the DAC output. Notice the
slope overload distortion. Keep the tuning knob so that the distortion is gone. Note this value
of the amplitude. This is the minimum required value of the amplitude to overcome slope
overload distortion.
5. Calculate the sampling frequency required for no slope overload distortion. Compare the
calculated and measured values of the sampling frequency.

DC LAB MANUAL Page 17


ELECTRONICS & COMMUNICATION ENGG.

WAVEFORM:

OBSERVATION TABLE:

Transmitter/ Receiver

Unipolar Integrator Comparator Bitable circuit


Bipolar
Converter
Output Input Output Input Output Input Output

Freq.
Amp.

RESULT: Thus the analog message signal in its digital form was transmitted and again the
original analog message signal was reconstructed at the receiver by using Delta modulator and
Demodulator.

DC LAB MANUAL Page 18


ELECTRONICS & COMMUNICATION ENGG.

EXPERIMENT NO. 9
AIM: Generation and detection of ASK, FSK, and PSK signals using MATLAB.

SOFTWARE USED: MATLAB

THEORY:

Amplitude Shift Keying (ASK) is a type of Amplitude Modulation which represents the
binary data in the form of variations in the amplitude of a signal. Any modulated signal has a high
frequency carrier. The binary signal when ASK modulated, gives a zero value for Low input while
it gives the carrier output for High input. The following figure represents ASK modulated
waveform along with its input.

Frequency shift keying (FSK) is a frequency modulation scheme in which digital


information is transmitted through discrete frequency changes of a carrier signal. The technology
is used for communication systems such as amateur radio, caller ID and emergency broadcasts.
The simplest FSK is binary FSK (BFSK). BFSK uses a pair of discrete frequencies to transmit
binary(0sand1s) in formation. With this scheme, the"1"iscalledthemarkfrequencyandthe"0"is
called the space frequency. This is simulated in MATLAB.
The simplest PSK technique is called binary phase-shift keying (BPSK). It uses two
opposite signal phases (0 and 180 degrees). The digital signal is broken up timewise into individual
bits (binary digits).
The state of each bit is determined according to the state of the preceding bit. If the phase
of the wave does not change, then the signal state stays the same (0 or 1). If the phase of the wave
changes by 180 degrees -- that is, if the phase reverses -- then the signal state changes (from 0 to
1, or from 1 to 0). Because there are two possible wave phases, BPSK is sometimes called biphase
modulation.
MATLAB (matrix laboratory) is a multi-paradigm numerical computing environment and
fourth-generation programming language. A proprietary programming language developed by
MathWorks, MATLAB allows matrix manipulations, plotting of functions and data,
implementation of algorithms, creation of user interfaces, and interfacing with programs written in
other languages, including C, C++, Java, Fortran and Python.

DC LAB MANUAL Page 19


ELECTRONICS & COMMUNICATION ENGG.

Although MATLAB is intended primarily for numerical computing, an optional toolbox


uses the MuPAD symbolic engine, allowing access to symbolic computing abilities. An additional
package, Simulink, adds graphical multi-domain simulation and model-based design for dynamic
and embedded systems. There are also free open source alternatives to MATLAB, in particular
GNU Octave, Scilab, Free Mat, Julia, and Sage which are intended to be mostly compatible with
the MATLAB language.

ALGORITHM:

1. Define the number of input samples.


2. Generate the binary input sequence.
3. Generate the carrier signal with frequency f1 and f2.
4. Generate ASK, FSK, PSK signal.
5. Reconstruct the original message signal
6. Plot the signal.

MATLAB CODE:
ASK

clc;
close all;
clear all;
n=10; % length of bit stream
b=[1 0 0 1 1 1 0 0 0 1]
f1=1;
f2=2;
t=0:1/30:1-1/30;

%ASK
sa1=sin(2*pi*f1*t);
E1=sum(sa1.^2);
sa1=sa1/sqrt(E1); %unit energy

DC LAB MANUAL Page 20


ELECTRONICS & COMMUNICATION ENGG.

sa0=0*sin(2*pi*f1*t);

%MODULATION
ask=[];
for i=1:n
if b(i)==1
ask=[ask sa1];
else
ask=[ask sa0];
end
end
figure(1)
subplot(211)
stairs(0:10,[b(1:10) b(10)],'linewidth',1.5)
axis([0 10 -0.5 1.5]); title('Message Bits'); grid on;
xlabel('Time');
ylabel('Amplitude')
subplot(212)
tb=0:1/30:10-1/30;
plot(tb, ask(1:10*30),'b','linewidth',1.5)
title('ASK Modulation');grid on;
xlabel('Time');
ylabel('Amplitude')

FSK-
clc;
clear all;

DC LAB MANUAL Page 21


ELECTRONICS & COMMUNICATION ENGG.

close all;
n=100;
x=[ones(1,20) zeros(1,20) ones(1,20) zeros(1,20) ones(1,20)];
subplot(4,1,1);
plot(x);
title('input signal'); xlabel('number of samples'); ylabel('amplitude');
f=1*10^6;
fs=20*10^6;
for i=0:n-1
d(i+1)=sin(2*pi*(f/fs)*i);
end
subplot(4,1,2);
plot(d);
title('carrier signal'); xlabel('number of samples'); ylabel('amplitude');
for i=0:n-1
if(x(i+1)==1)
x(i+1)=sin((2*pi*(f/fs)*i));
else
x(i+1)=sin((2*pi*((4*(f/fs)))*i));
end
end
subplot(4,1,3); plot(x);
title('FSK Signal');
xlabel('number of samples');
ylabel('amplitude');
for i=0:n-1
if(x(i+1)==sin((2*pi*(f/fs)*i)))

DC LAB MANUAL Page 22


ELECTRONICS & COMMUNICATION ENGG.

x(i+1)=1;
else
x(i+1)=0;
end
end
subplot(4,1,4); plot(x); title('FSK demodulated Signal'); xlabel('number of samples');
ylabel('amplitude');

PSK –
clc;
clear all;
close all;
n=100;
x=[ones(1,20) zeros(1,20) ones(1,20) zeros(1,20) ones(1,20)];
subplot(4,1,1);
plot(x); title('input signal');
xlabel('number of samples');
ylabel('amplitude');
f=1*10^6;
fs=10*10^6;
for i=0:n-1
d(i+1)=sin(2*pi*(f/fs)*i);
end
subplot(4,1,2); plot(d);
title('carrier signal');
xlabel('number of samples');
ylabel('amplitude');
for i=0:n-1

DC LAB MANUAL Page 23


ELECTRONICS & COMMUNICATION ENGG.

if(x(i+1)==0)
x(i+1)=sin(2*pi*(f/fs)*i);
else
x(i+1)=sin(2*pi*(f/fs)*i+pi);
end
end
subplot(4,1,3);
plot(x);
title('PSK Signal');
xlabel('number of samples');
ylabel('amplitude');
for i=0:n-1
if(x(i+1)==sin(2*pi*(f/fs)*i)) x(i+1)=0;
else
x(i+1)=1;
end
end
subplot(4,1,4);
plot(x);
title('demodulated Signal');
xlabel('number of samples');
ylabel('amplitude');

OUTPUT:

ASK-

DC LAB MANUAL Page 24


ELECTRONICS & COMMUNICATION ENGG.

FSK-

PSK –

RESULT: Thus, the simulation of FSK was performed in MATLAB and corresponding waveform
were plotted successfully.

DC LAB MANUAL Page 25


ELECTRONICS & COMMUNICATION ENGG.

EXPERIMENT NO. 10
AIM: Generation and detection of DPSK signals using MATLAB.

SOFTWARE USED: MATLAB

THEORY:

Differential phase shift keying (DPSK), a common form of phase modulation conveys
data by changing the phase of carrier wave. In DPSK, there is no absolute carrier phase
reference, instead transmitted signal itself used as phase reference. For example, in
differentially encoded BPSK a binary '1' may be transmitted by adding 180° to the current
phase and a binary'0' by adding 0°to the current phase. For a signal that has been differentially
encoded, there is an obvious alternative method of demodulation. Instead of demodulating as usual
and ignoring carrier-phase ambiguity, the phase between two successive received symbols is
compared and used to determine what the data must have been. When differential encoding is used
in this manner, the scheme is known as differential phase-shift keying (DPSK).

ALGORITHM:

1. Define the number of input samples.


2. Generate the binary input sequence.
3. Generate the carrier signal with frequency f1.
4. Generate DPSK signal.
5. Reconstruct the original message signal
6. Plot the message, carrier, modulated and demodulated signal.

PROGRAM:
clc; clear all; close all;
n=100;
x=[ones(1,20) zeros(1,20) ones(1,20) zeros(1,20) ones(1,20)];
subplot(4,1,1);
plot(x);
title('input signal');
xlabel('number of samples');
ylabel('amplitude');
f=1*10^6;
fs=10*10^6;
DC LAB MANUAL Page 26
ELECTRONICS & COMMUNICATION ENGG.

for i=0:n-1
d(i+1)=sin(2*pi*(f/fs)*i);
end
subplot(4,1,2); plot(d);
title('carrier signal');
xlabel('number of samples');
ylabel('amplitude');
for i=0:n-1
if(x(i+1)==0)
x(i+1)=sin(2*pi*(f/fs)*i);
else
x(i+1)=sin(2*pi*(f/fs)*i+pi);
end
end
subplot(4,1,3);
plot(x);
title('PSK Signal');
xlabel('number of samples');
ylabel('amplitude');
for i=0:n-1
if(x(i+1)==sin(2*pi*(f/fs)*i))
x(i+1)=0;
else
x(i+1)=1;
end
end
subplot(4,1,4); plot(x);

DC LAB MANUAL Page 27


ELECTRONICS & COMMUNICATION ENGG.

title('demodulated Signal');
xlabel('number of samples');
ylabel('amplitude');
OUTPUT:

RESULT: Thus, the simulation of DPSK was performed in MATLAB and corresponding
waveforms were plotted successfully.

DC LAB MANUAL Page 28


ELECTRONICS & COMMUNICATION ENGG.

EXPERIMENT. 11
AIM: Generation and detection of Direct Sequence Spread Spectrum (DSSS).

SOFTWARE USED: MATLAB

THEORY:

In telecommunication and radio communication, spread-spectrum techniques are


methods by which a signal (e.g.an electrical, electromagnetic, or acoustic signal)
generated with a particular bandwidth is deliberately spread in the frequency domain,
resulting in a signal with a wider bandwidth. These techniques are used for a variety of
reasons, including the establishment of secure communications, increasing resistance to
natural interference, noise and jamming, to prevent detection, and to limit power flux
density (e.g.in satellite downlinks).

Frequency-hopping spread spectrum (FHSS), direct-sequence spread spectrum (DSSS),


time-hopping spread spectrum (THSS), chirp spread spectrum (CSS), and combinations
of these techniques are forms of spread spectrum. Each of these techniques employs
pseudorandom number sequences — created using pseudo random number generators —
to determine and control the spreading pattern of the signal across the allocated
bandwidth. In DSSS the message signal is used to modulate a bit sequence known as the
Pseudo Noise (PN) code; this PN code consists of pulses of a much shorter duration
(larger bandwidth) than the pulse duration of the message signal, therefore the modulation
by the message signal has the effect of chopping up the pulses of the message signal and
thereby resulting in a signal which has a bandwidth nearly as large as that of the PN
sequence. In this context the duration of the pulse of the PN code is referred to as the chip
duration and the smaller this value, the larger the bandwidth of the resultant DSSS signal
and the more immune to interference the resultant signal becomes.
Some of the uses of DSSS include the Code Division Multiple Access (CDMA) channel
access method and the IEEE802.11b specification used in Wi-Fi networks.

ALGORITHM:
1. Define the PN bitstream.
2. Define the input bitstream.
3. Obtain the DSSS stream.
4. Plot the PN bitstream, input bit stream and DSSS stream.

PROGRAM:

clc; clear all; close all;


PNbit_stream = round(rand(1,32));
input_signal=[1 1 0 0 1 0 1 1];

DC LAB MANUAL Page 29


ELECTRONICS & COMMUNICATION ENGG.

PNbit_stream;
for i=1:1:8
for j=1:4:32
for k=1:1:4
a(j)=xor(PNbit_stream(k+j-1),input_signal(i));
a(j);
end
end
end
subplot(3,1,1);
stem(PNbit_stream);
title('PNbit_stream');
subplot(3,1,2);
stem(input_signal);
title('input_signal');
subplot(3,1,3);
stem(a);
title('DSSS');

OUTPUT:

RESULT:Thus, the simulation of Direct Sequence Spread Spectrum was performed in MATLAB
and corresponding waveforms were plotted successfully.

DC LAB MANUAL Page 30


ELECTRONICS & COMMUNICATION ENGG.

EXPERIMENT. 12

AIM- Generation and detection of Frequency Hopping Spread Spectrum (FHSS).

SOFTWARE USED: MATLAB R2020b

THEORY:
In Frequency Hoping Spectrum, available channel bandwidth is broken into a large number
of non-overlapping frequency slots. Data is modulated onto time-varying, Pseudo random carrier
frequencies. Transmitter “hops” between different narrowband Channels with centre frequency fi,
and bandwidth B (instantaneous bandwidth). Spectrum BW (bandwidth) over which hopping
occurs is called the total hopping. Data sent by hopping transmitter carrier to seemingly random
channels which are known only to desired receiver. On each channel, data bursts are sent using
conventional narrowband modulation hopping period/hop duration.
There are generally two types of hopping schemes employed in FHSS-
Fast Hopping: In this scheme the hopping rate is kept equal to or greater than the Data rate. The
hopping rate should not be many time faster than the data rate. Generally, it can be 2-3 times faster
than the data rate.
Slow Hopping: In this scheme the hopping rate is kept lower than the data rate. Also, the data rates
which can be supported by FHSS system are quite lower than the data rates supported by DSSS
systems.
PROGRAM:
clc
clear all;
% Generation of bit pattern
s=round(rand(1,25)); % Generating 25 bits
signal=[];
carrier=[];
t=[0:2*pi/119:2*pi]; % Creating 120 samples for one cosine
for k=1:25
if s(1,k)==0
sig=-ones(1,120); % 120 minus ones for bit 0

DC LAB MANUAL Page 31


ELECTRONICS & COMMUNICATION ENGG.

else
sig=ones(1,120); % 120 ones for bit 1
end
c=cos(t);
carrier=[carrier c];
signal=[signal sig];
end
subplot(4,1,1);
plot(signal);
axis([-100 3100 -1.5 1.5]);
title('\bf\it Original Bit Sequence');

% BPSK Modulation of the signal


bpsk_sig=signal.*carrier; % Modulating the signal
subplot(4,1,2);
plot(bpsk_sig)
axis([-100 3100 -1.5 1.5]);
title('\bf\it BPSK Modulated Signal');

% Preparation of 6 new carrier frequencies


t1=[0:2*pi/9:2*pi];
t2=[0:2*pi/19:2*pi];
t3=[0:2*pi/29:2*pi];
t4=[0:2*pi/39:2*pi];
t5=[0:2*pi/59:2*pi];
t6=[0:2*pi/119:2*pi];
c1=cos(t1);

DC LAB MANUAL Page 32


ELECTRONICS & COMMUNICATION ENGG.

c1=[c1 c1 c1 c1 c1 c1 c1 c1 c1 c1 c1 c1];
c2=cos(t2);
c2=[c2 c2 c2 c2 c2 c2];
c3=cos(t3);
c3=[c3 c3 c3 c3];
c4=cos(t4);
c4=[c4 c4 c4];
c5=cos(t5);
c5=[c5 c5];
c6=cos(t6);

% Random frequency hopps to form a spread signal


spread_signal=[];
for n=1:25
%c=randint(1,1,[1 6]);
c=randi([1 6],1,1);

switch(c)
case(1)
spread_signal=[spread_signal c1];
case(2)
spread_signal=[spread_signal c2];
case(3)
spread_signal=[spread_signal c3];
case(4)
spread_signal=[spread_signal c4];
case(5)

DC LAB MANUAL Page 33


ELECTRONICS & COMMUNICATION ENGG.

spread_signal=[spread_signal c5];
case(6)
spread_signal=[spread_signal c6];
end
end
subplot(4,1,3)
plot([1:3000],spread_signal);
axis([-100 3100 -1.5 1.5]);
title('\bf\it Spread Signal with 6 frequencies');

% Spreading BPSK Signal into wider band with total of 6 frequencies


freq_hopped_sig=bpsk_sig.*spread_signal;
subplot(4,1,4)
plot([1:3000],freq_hopped_sig);
axis([-100 3100 -1.5 1.5]);
title('\bf\it Frequency Hopped Spread Spectrum Signal');

OUTPUT-

DC LAB MANUAL Page 34


ELECTRONICS & COMMUNICATION ENGG.

RESULT:
Thus, the simulation of Frequency Hopping Spread Spectrum (FHSS) was performed in
MATLAB and corresponding waveforms were plotted successfully.

DC LAB MANUAL Page 35

You might also like