DComm File
DComm File
Submitted By:
SAMRIDDHI JAIN
CSE T17
Roll No: 41196202718
ADGITM, Delhi
INDEX
EXPERIMENT NO. 1
AIM: To study CRO.
APPARATUS: CRO, Power Supply, Probe, Jumper Wires, Function Generator.
THEORY:
The CRO stands for a cathode ray oscilloscope. The cathode ray oscilloscope is an electronic test
instrument. It is used to obtain waveforms when the different input signals are given. In the early days, it
was called as an Oscillograph. The oscilloscope observes the changes in the electrical signals over time, thus
the voltage and time describe a shape and it is continuously graphed beside a scale. By seeing the
waveform, we can analyze some properties like amplitude, frequency, rise time, distortion, time interval
and etc. Karl Ferdinand Braun invented it in 1897.
Working Principle of CRO: It works on the principle of the deflection of the electron beam with the help of
deflection plates before it falls over the phosphorescent screen.
Block Diagram of CRO:
Buttons of CRO:
1. On/Off: This is required to turn the CRO on or off as per the requirement.
2. Channel Select: As we know most of the CRO can work simultaneously with two signals and thus
there is a toggle switch present in the controls regarding the selection, i.e., if both the channels are
used or only one is used. So, selection must be done accordingly. If both the channels are used the
selection should be ‘Dual’ and if only one channel is used it should be either ‘channel 1’ or ‘channel
2’ depending on the connection.
3. Trigger Hold-Off: The trace in a CRO is performed by the sweeping of electrons for a small period of
time on the phosphorous screen by the voltage generated due to the signal. This voltage is known
as sweep voltage. When the ‘sweep’ is completed the voltage returns to its original value and thus
forcing the beam of electrons to move back. This process is called ‘retrace’, when the retrace is
completed again sweep starts. Hold-Off determines the time that tends to pass between ‘retrace’
and ‘sweep’. Initially it is set to zero, but to avoid the certain peaks and noises in the signal the
sweep time can be increased to obtain a stable signal at the display.
4. AC/DC/GD: This is a toggle switch to tell the CRO about the filtering of the i/p signal channel. There
is one present for each channel.
▪ AC (Alternating Current Coupling): If the switch is at AC then the signal will go through a RC-
filter to remove its DC components.
▪ DC (Direct Current Coupling): If the switch is at DC position then the signal will not go
through a RC-filter and the DC components will persist in the signal.
▪ GD (Ground): If the switch is at the GD position then the input signal is shorted and thus a
horizontal line is seen in the display symbolizing no potential difference between ground and
input signal.
5. Focus: This rotating knob is used to improve the sharpness of an image of the signal on the screen
by adjusting the focus of the electronic beam. Thus, it helps in taking the proper measurements and
to study the correct shape of the signal by removing the blurriness of the signal.
6. Intensity: This knob is used to increase the intensity of the input signal for better examination of the
displayed output on the screen. There is a common misconception regarding this knob to be a
brightness control feature but it is not so, this increases the number of electrons in the beam so that
more and more electrons collide the phosphorus screen for better view of the applied input signal.
This knob is marked as ‘Intense’ on the CRO.
7. +/- : This determines if the signal is triggered during the positive flank or the negative flank.
Triggering is the synchronization of the horizontal sweep of the CRO with the proper point of the
signal. If the button is on, descending slope of the signal is used while triggering otherwise the
ascending slope of the signal is used.
8. At/Norm: Using this button you can select between Automatic triggering (At.) and manual triggering
level selection.
9. Level: When the triggering is set to manual mode this wheel is used to set the level of manual
triggering, the +/- button will make sure ascending level triggering or descending level triggering is
used.
10. Ext.: This button is used when the timing of the CRO is not determined by the input waveform but
from some another external waveform. There is an input connector beside the button where the
external input is connected for the display of the waveform.
RESULT: Hence we studied CRO.
EXPERIMENT NO. 2
AIM: To study MATLAB software
APPARATUS: CRO, Power Supply, Probe, Jumper Wires, Function Generator.
THEORY:
The name MATLAB stands for Matrix Laboratory. MATLAB was written originally to provide easy access to
matrix software developed by the LINPACK (linear system package) and EISPACK (Eigen system package)
projects.
It allows matrix manipulations, plotting of functions and data, implementation of algorithms, creation of
user interfaces, and interfacing with programs written in other languages. it has sophisticated data
structures, contains built-in editing and debugging tools, and supports object-oriented programming.
It has powerful built-in routines that enable a very wide variety of computations. It also has easy to use
graphics commands that make the visualization of results immediately available. Specific applications are
collected in packages referred to as toolbox. There are toolboxes for signal processing, symbolic
computation, control theory, simulation, optimization, and several other fields of applied science and
engineering.
Basics Functions in MATLAB:
Operators and Elementary Operations:
1. Arithmetic Operations:
+ Addition
- Subtraction
* Multiplication
* Matrix Multiplication
/ Right Array Division
\ Left Array Division
mod Remainder after division (modulo operation)
rem Remainder after division
2. Relational Operations:
== Determine equality
>= Determine greater than or equal to
> Determine greater than
<= Determine less than or equal to
< Determine less than
~= Determine inequality
3. Logical Operations:
4. Entering Commands
Data Types:
1. Numeric Types:
Examples:
Array Creation
To create an array with four elements in a single row, separate the elements with either a comma (,) or a
space.
▪ a = [1 2 3 4]
Row vector
To create a matrix that has multiple rows, separate the rows with semicolons.
▪ a = [1 2 3; 4 5 6; 7 8 9]
Another way to create a matrix is to use a function, such as ones, zeros, or rand. For example, create a 5-
by-1 column vector of zeros.
▪ z = zeros(5,1)
▪ a+10
▪ sin(a)
You can perform standard matrix multiplication, which computes the inner products between rows and
columns, using the * operator. For example, confirm that a matrix times its inverse returns the identity
matrix:
▪ p = a*inv(a)
Concatenation
Concatenation is the process of joining arrays to make larger ones. In fact, we made our first array by
concatenating its individual elements. The pair of square brackets [] is the concatenation operator.
▪ A = [a,a]
Concatenating arrays next to one another using commas is called horizontal concatenation. Each array must
have the same number of rows. Similarly, when the arrays have the same number of columns, we can
concatenate vertically using semicolons.
▪ A = [a; a]
Complex Numbers
Complex numbers have both real and imaginary parts, where the imaginary unit is the square root of -1.
▪ sqrt(-1)
EXPERIMENT NO. 3
AIM: To study sampling theorem and reconstruction of the signal using trainer kit.
APPARATUS REQUIRED: CRO, Power Supply, Probe, Jumper wires, Sampling & Reconstruction Trainer Kit.
THEORY:
As a first step to convert analog signals into digital form, the samples of the analog signals are taken at
regular intervals. The levels of these samples are then encoded and sent to the receiver. At the receiver,
these samples are recovered and from that the original signal is reconstructed.
Sampling theorem states that the original signal can be faithfully reconstructed only if the sampling
frequency is at least double that of the highest frequency component in the sampled signal.
A sampling and reconstruction circuit is shown in figure. An FET is used as a switch to take samples of the
sine wave input. Sampling pulses are applied to the gate of the FET that switches it ON and OFF. The input
signal is sent to the output only when the transistor is ON. Thus, the output of the FET is a sampled form of
the input signal. The reconstruction circuit is a low pass filter having a cut off frequency equal to the
frequency of the analog input signal.
WORKING:
Sampling is the process of measuring the instantaneous values of continuous-time signal in a discrete form.
Sampling is required:
1. Sampling is used any time data is to be gathered.
Data cannot be collected until the sample size (how much) and sample frequency (how often) have
been determined.
Samriddhi Jain 41196202718 T-17
P a g e | 11
Sampling Theorem:
The sampling theorem is also called as Nyquist theorem. The sampling theorem states that, “A
continuous-time (analog) signal may be represented in its samples and recovered back if the sampling
rate fs is greater than twice the maximum frequency fm.
Fs>=2fm Aliasing:
The phenomenon of a high-frequency component in the spectrum of a signal, taking on the identity of a
low – frequency component in the spectrum of its sampled version.
How to prevent aliasing?
We can simply avoid aliasing by sampling the signal at a higher rate than the Nyquist rate (Fs>=Fm). Or,
we can use anti-aliasing filters. These are special low-pass filters that are usually found in the initial
stages of any digital signal processing operation. The anti-aliasing filters attenuate the unnecessary
high-frequency components of a signal. They band-limit the input signal by removing all frequencies
higher than the signal frequencies. As a result, they help preserve a lot of information that is needed
and remove unnecessary information.
Interpolation
“Upsampling” is the process of inserting zero-valued samples between original samples to increase the
sampling rate. “Interpolation”, in the DSP sense, is the process of upsampling followed by filtering. (The
filtering removes the undesired spectral images.)
Block Diagram:
WAVEFORMS:
1. Sampling signal
2. Analog input signal
3. Sampled output
4. Re-constructed signal
OBSERVATION:
Result: Analog Input is sampled at different sampling rates and then reconstructed. Observed the
waveforms and plotted. Hence, we have studied sampling and reconstruction.
Inference:
1. To reconstruct the original signal, the sampling frequency should at least be double that of the input
frequency.
2. Reconstructed signal quality improves with increase in sampling frequency beside the button where
the external input is connected for the display of the waveform.
EXPERIMENT NO. 4
AIM: To study sampling theorem and reconstruction of the signal using MATLAB.
THEORY:
Sampling:
A continuous time signal can be processed by processing its samples through a discrete time system. For
reconstructing the continuous time signal from its discrete time samples without any error, the signal
should be sampled at a sufficient rate that is determined by the sampling theorem.
Nyquist Sampling Theorem:
If a signal is band limited and its samples are taken at sufficient rate then, those samples uniquely specify
the signal and the signal can be reconstructed from those samples.
CODE:
%Oversampling : fs>2fm
fm =100;
fs =600;
t=0:1/fs:((10/fm)-(1/fs)); %10 cycles 60 Samples
x = sin(2*pi*fm*t);
fx = fft(x,64) ;
xr=ifft(fx,64); % inv fft generates 64 samples
f= (-31*fs/64) : (fs/64) : (32*fs/64) ;
fx=[fx(34:64) fx(1:33)];
plot(231), stem(x), title('sampled signal, fm=100,fs=600');
plot(232), stem(f, abs(fx)), axis([-300 300 0 30]), title('frequency spectrum, fm=100, fs=600');
plot(233), stem(xr), title('recovered signal, fm =100, fs=600');
Output:
%Undersampling : fs<2fm
fm=400;
x=sin(2*pi*fm*t);
fx=fft(x,64);
xr = ifft(fx,64);
fx=[fx(34:64) fx(1:33)];
plot(234), stem(x), title('sampled signal, fm=400,fs=600');
plot(235), stem(f, abs(fx)), axis([-300 300 0 30]), title('frequency spectrum, fm=400, fs=600');
plot(236), stem(xr), title('recovered signal, fm =400, fs=600');
Output:
EXPERIMENT NO. 5
AIM: To study modulation and demodulation of TDM-PAM (Time division multiplexing – Pulse amplitude
modulation).
APPARATUS REQUIRED: TDM-PAM, CRO, connecting wires.
THEORY:
A sampled waveform is “off” most of the time, leaving the time between samples available for other
purposes. In particular, sample values from several different signals can be interleaved into a single
waveform. This is the principle of time-division multiplexing (TDM) discussed here.
The simplified system in Figure (1) demonstrates the essential features of time division multiplexing.
Several input signals are prefiltered by the bank of input LPFs and sampled sequentially. The rotating
sampling switch or commutator at the transmitter extracts one sample from each input per revolution.
Hence, its output is a PAM waveform that contains the individual samples periodically interleaved in time. A
similar rotary switch at the receiver, called a decommutator or distributor, separates the samples and
distributes them to another bank of LPFs for reconstruction of the individual messages.
If all inputs have the same message bandwidth 𝑊, the commutator should rotate at the rate 𝑓𝑠 ≥ 2𝑊 so
that successive samples from any one input are spaced by 𝑇𝑠 = 1/𝑓𝑠 ≤ 1/2𝑊. The time interval 𝑇𝑠
containing one sample from each input is called a frame. If there are 𝑀 input channels, the pulse-to-pulse
spacing within a frame is 𝑇𝑠/𝑀 = 1/𝑀𝑓𝑠. Thus, the total number of pulses per second will be: 𝑟 = 𝑀𝑓𝑠 ≥
2𝑀𝑊 (1) which represents the pulse rate or signaling rate of the TDM signal.
Our primitive example system shows mechanical switching to generate multiplexed PAM, but almost all
practical TDM systems employ electronic switching. Regardless of the type of pulse modulation, TDM
systems require careful synchronization between commutator and decommutator. Synchronization is a
critical consideration in TDM, because each pulse must be distributed to the correct output line at the
appropriate time. A popular brute force synchronization technique devotes one time slot per frame to a
distinctive marker pulse or non-pulse, as illustrated in Figure (2). These markers establish the frame
frequency 𝑓𝑠 at the receiver, but the number of signal channels is reduced to 𝑀 − 1. Other synchronization
methods involve auxiliary pilot tones or the statistical properties of the TDM signal itself.
WORKING:
Part I: 4-Channel PAM/TDM Transmitter
1. Carry out the connection between modules T20E and T20D with FAST mode operation.
2. Use the Function Generator block of the T20E board to generate 0.5, 1, 1.5, 2 kHz sinusoidal
modulating signals of 1Vpp respectively. Display and sketch the generated message signals.
3. Examine the sampling pulses related to 4 channels to check that the pulses are shifted with 25 𝜇s
between them. Display and sketch theses sampling pulses.
4. Use the Sampling block of the T20D board to generate 8 kHz PAM signal at each channel. Display and
sketch the PAM signals.
5. Use summation ( ∑ )block to generate PAM/TDM signal. Verify that the first-time slot contains the
synchronism (negative pulse) but other slots contain the pulses from the PAM signals. Display and
sketch the generated frame signal.
Samriddhi Jain 41196202718 T-17
P a g e | 20
BLOCK DIAGRAM :
Figure (1): TDM system: (a) block diagram; (b) waveforms.
OBSERVATION:
1. input signals
2. multiplexed signal( tx output or rx input)
3. output signal(rx-output is similar to my transmitter input but with little distortion)
RESULT:
The modulation and demodulation of TDM-PAM has been studied.
PRECAUTIONS:
1. Switch off the CRO when not in use
2. Handle the probes carefully
3. Trace should be taken carefully
DISCUSSION:
TDM is used for long distance communication, Telephone companies and ISP implement through digital
signals.
EXPERIMENT NO. 6
AIM: To study modulation and demodulation of TDM-PCM (Time division multiplexing – Pulse code
modulation) using kit.
APPARATUS REQUIRED: CRO, power supply, probes, TDM-PCM transmitter kit, TDM-PCM receiver kit,
jumper wires, connecting wires, RNC cable.
THEORY:
Multiplexing (or muxing) is a way of sending multiple signals or streams of information over a
communications link at the same time in the form of a single, complex signal; the receiver recovers the
separate signals, a process called demultiplexing (or demuxing).
Types of Multiplexing:
1) TDM: Time-division multiplexing (TDM) is a digital (or in rare cases, analog) technology, which uses
time, instead of space or frequency, to separate the different data streams. TDM involves
sequencing groups of a few bits or bytes from each individual input stream, one after the other, and
in such a way that they can be associated with the appropriate receiver. If done sufficiently quickly,
the receiving devices will not detect that some of the circuit time was used to serve another logical
communication path.
2) FDM: Frequency-division multiplexing (FDM) is inherently an analog technology. FDM achieves the
combining of several signals into one medium by sending signals in several distinct frequency ranges
over a single medium. In FDM the signals are electrical signals. One of the most common
applications for FDM is traditional radio and television broadcasting from terrestrial, mobile or
satellite stations, or cable television.
3) WDM: In fiber-optic communications, wavelength-division multiplexing (WDM) is a technology
which multiplexes a number of optical carrier signals onto a single optical fiber by using different
wavelengths (i.e., colors) of laser light. This technique enables bidirectional communications over
one strand of fiber, as well as multiplication of capacity.
PCM: Pulse-code modulation (PCM) is a method used to digitally represent sampled analog signals. It is the
standard form of digital audio in computers, compact discs, digital telephony and other digital audio
applications. In a PCM stream, the amplitude of the analog signal is sampled regularly at uniform intervals,
and each sample is quantized to the nearest value within a range of digital step.
EXPERIMENT NO. 7
AIM: To study Pulse code modulation/demodulation using MATLAB.
THEORY:
Multiplexing (or muxing) is a way of sending multiple signals or streams of information over a
communications link at the same time in the form of a single, complex signal; the receiver recovers the
separate signals, a process called demultiplexing (or demuxing).
PCM:
Pulse-code modulation (PCM) is a method used to digitally represent sampled analog signals. It is the
standard form of digital audio in computers, compact discs, digital telephony and other digital audio
applications. In a PCM stream, the amplitude of the analog signal is sampled regularly at uniform intervals,
and each sample is quantized to the nearest value within a range of digital steps.
CODE:
%Pulse Code Modulation Analog Signal-Sinusoidal
f=2;
fs = 20*f;
t= 0:1/fs:1;
a=2;
x= a*sin(2*pi*f*t);
x1 = x+a;
q_op = round(x1);
enco = dec2bin(q_op);
deco = bin2dec(enco);
xr = deco-a;
plot(t,x,'-r',t,xr,'k+-');
xlabel('Time');
ylabel('amplitude');
legend('original signal', 'reconstructed signal');
print -dpng figure.png;
OUTPUT:
EXPERIMENT NO. 8
AIM: To study Delta Modulation.
APPARATUS REQUIRED: CRO, power supply, probes, jumper wires, connecting wires, RNC cable.
THEORY:
The type of modulation, where the sampling rate is much higher and in which the step size after
quantization is of a smaller value Δ, such a modulation is termed as delta modulation.
Delta Modulation is a simplified form of DPCM technique, also viewed as 1-bit DPCM scheme. As the
sampling interval is reduced, the signal correlation will be higher.
Delta Modulator
The Delta Modulator comprises of a 1-bit quantizer and a delay circuit along with two summer circuits.
Following is the block diagram of a delta modulator.
Delta Demodulator
The delta demodulator comprises of a low pass filter, a summer, and a delay circuit. The predictor circuit is
eliminated here and hence no assumed input is given to the demodulator.
CODE:
% it also shows slope overload cases
step = 0.1; % step size
Samriddhi Jain 41196202718 T-17
P a g e | 29
%Modulation
xq(1) = 0;
d(1) = 0;
for n=2:length(x),
d(n)=sign(x(n)-xq(n-1));
xq(n)=xq(n-1)+d(n)*step;
end
subplot(232);
plot(d(1:100)), axis([0 100 -1.2 1.2]);
title('First 100 output of delta modulation ');
%Demodulation
y=0;
for n=2:length(d),
y(n)=y(n-1)+d(n);
end;
subplot(233), plot(y);
title('demodulation by summing');
xr=filter([0.125*ones(1,8)],1,y); % 8th order moving average filter
subplot(234), plot(xr), title('Filtering to smoothing edge');
A-2.5;
x= A*x; %max. slope=2.5*62.8=157, slope overloading
%Modulation
xq(1)=0;
d(1)=0;
for n=2:length(x),
d(n)=sign(x(n)-xq(n-1)); xq(n)=xq(n-1)+d(n)*step;
end
%Demodulation
y=0;
for n=2:length(d),
y(n)=y(n-1)+d(n);
end
subplot(235), plot(y);
title('demodulation by summing, slope overload');
xr=filter([0.125*ones(1,8)],1,y);
subplot(236), plot(xr), title('Filtered , slope overload');
OUTPUT:
EXPERIMENT NO. 9
AIM: To study Adaptive Delta Modulation.
APPARATUS REQUIRED: CRO, power supply, probes, jumper wires, connecting wires, RNC cable.
THEORY:
A larger step-size is needed in the steep slope of modulating signal and a smaller step size is needed where
the message has a small slope. The minute details get missed in the process. So, it would be better if we can
control the adjustment of step-size, according to our requirement in order to obtain the sampling in a
desired fashion. This is the concept of Adaptive Delta Modulation.
Transmitter: The transmitter has a summer, a quantizer, a delay circuit, and a logic circuit. Here, the step
size is kept fixed between some predefined maximum and minimum values.
The upper limit is used to control the slope overload distortion and the lower limit is used to control the
granular noise. The step size increase or decreases based on a certain set of rules.
Receiver: The ADM receiver has two parts. The first part is used to produce the step size from the incoming
bits. The bits are then applied to the second part of the receiver which contains an accumulator. The
function of the accumulator is to build up the staircase waveform. The signal is then passed through a low
pass filter which is used to smoothen the staircase waveform and reconstruct the original signal.
CODE:
t =0:1/29:1;
f=1;
x=4*sin(2*pi*f*t);
x=[x ones(1,10) x];
y = zeros(1,length(x));
d = zeros(1,length(x));
e= zeros(1,length(x));
s=0.1;
for i=5:length(x)
if(x(i)-y(i-1))>=0
y(i) = x(i)-s; d(i)=-1;
elseif(x(i)-y(i-1))<0
y(i)=x(i)-1; d(i)=-1;
end
if(sum(d(i-4:i)))>3
s=s+0.01;
elseif(sum(d(i-4:i)))<-3
s=s+0.01;
elseif(sum(d(i-4:i)))==0
Samriddhi Jain 41196202718 T-17
P a g e | 35
s=s-0.01;
else
s=s;
end
pause;
subplot (211);
plot(x);
hold on;
stem(y,'m');
e=x-y;plot(e,'r');
title('Input,tracking and error graph');
subplot (212);
stem (d,'k');
title('output data signal') ;
end
OUTPUT :
EXPERIMENT-10
AIM: Generating Rayleigh distribution for different alpha.
THEORY:
Weibull Distribution (Rayleigh Distribution) The Weibull distribution describes data resulting from life and
fatigue tests. It is commonly used to describe failure time in reliability studies as well as the breaking
strengths of materials in reliability and quality control tests. Weibull distributions are also used to represent
various physical quantities, such as wind speed. The Weibull distribution is a family of distributions that can
assume the properties of several other distributions. For example, depending on the shape parameter you
define, the Weibull distribution can be used to model the exponential and Rayleigh distributions, among
others. The Weibull distribution is very flexible.
CODE:
% generating RAYLEIGH distribution for different alpha
x =0:0.05:4;
y=raylpdf(x,0.4); %raylpdf is in-built function
subplot(131);
plot(x,y);
axis([0 4 0 2]);
title('Alpha=0.4');
y=raylpdf(x,0.7);
subplot(132);
plot(x,y) , axis([0 4 0 2]);
title('Alpha=0.7');
y=poisspdf(x,1.2);
subplot(133); plot(x,y) , axis([0 4 0 2]);
title('Alpha=1.2');
OUTPUT:
EXPERIMENT-11
AIM: Generating Poisson distribution for different alpha
THEORY:
The Poisson distribution describes the number of times an event occurs in a given interval, such as the
number of telephone calls per minute or the number of errors per page in a document. The three
conditions underlying the Poisson distribution are:
1. The number of possible occurrences in any interval is unlimited.
2. The occurrences are independent. The number of occurrences in one interval does not affect the
number of occurrences in other intervals.
3. The average number of occurrences must remain the same from interval to interval.
CODE:
% generating Poisson distribution for different alpha
x =0:30;
y=poisspdf(x,5); %poisspdf is in-built function
subplot(131); plot(x,y); axis([0 30 0 0.2]); title('Alpha=5'); y=poisspdf(x,10);
subplot(132); plot(x,y) , axis([0 30 0 0.2]); title('Alpha=10'); y=poisspdf(x,15);
subplot(133); plot(x,y) , axis([0 30 0 0.2]); title('Alpha=15');
OUTPUT:
EXPERIMENT NO. 12
AIM: Generating Gaussian distribution for different alpha.
THEORY:
In probability theory, a normal (or Gaussian or Gauss or Laplace–Gauss) distribution is a type of continuous
probability distribution for a real-valued random variable. The general form of its probability density
function is
A random variable with a Gaussian distribution is said to be normally distributed, and is called a normal
deviate.
Normal distributions are important in statistics and are often used in the natural and social sciences to
represent real-valued random variables whose distributions are not known. Their importance is partly due
to the central limit theorem. It states that, under some conditions, the average of many samples
(observations) of a random variable with finite mean and variance is itself a random variable—whose
distribution converges to a normal distribution as the number of samples increases. Therefore, physical
quantities that are expected to be the sum of many independent processes, such as measurement errors,
often have distributions that are nearly normal.
CODE:
% generating GAUSSIAN distribution for different alpha
x =-5:0.05:5;
y=normpdf(x,0,1); %mean = 0 , std deviation =1 normpdf is in build functio
subplot(131); plot(x,y); axis([-5 5 0 1]); title('mean=0, std dev=1'); y=raylpdf(x,0,0.5);
subplot(132); plot(x,y) , axis([-5 5 0 1]); title('mean=0, std dev=0.5'); y=poisspdf(x,1,1);
subplot(133); plot(x,y) , axis([-5 5 0 1]); title('mean=1, std dev=1');
OUTPUT:
EXPERIMENT NO. 13
AIM: To perform line coding using MATLAB
THEORY:
A line code is the code used for data transmission of a digital signal over a transmission line. This process of
coding is chosen so as to avoid overlap and distortion of signal such as inter-symbol interference.
Unipolar Signaling
Unipolar signaling is also called as On-Off Keying or simply OOK.
The presence of pulse represents a 1 and the absence of pulse represents a 0. There are two variations in
Unipolar signaling –
▪ Non-Return to Zero NRZ: In this type of unipolar signaling, a High in data is represented by a positive
pulse called as Mark, which has a duration T0 equal to the symbol bit duration. A Low in data input
has no pulse.
▪ Return to Zero RZ: In this type of unipolar signaling, a High in data, though represented by a Mark
pulse, its duration T0 is less than the symbol bit duration. Half of the bit duration remains high but it
immediately returns to zero and shows the absence of pulse during the remaining half of the bit
duration.
Polar Signaling
There are two methods of Polar Signaling. They are −
▪ Polar NRZ: In this type of Polar signaling, a High in data is represented by a positive pulse, while a
Low in data is represented by a negative pulse.
▪ Polar RZ: In this type of Polar signaling, a High in data, though represented by a Mark pulse, its
duration T0 is less than the symbol bit duration. Half of the bit duration remains high but it
immediately returns to zero and shows the absence of pulse during the remaining half of the bit
duration.
However, for a Low input, a negative pulse represents the data, and the zero level remains same for
the other half of the bit duration.
CODE:
%NRZ UNIPOLAR LINE CODING
%INPUT SEQUENCE
n=[1,0,1,0,1];
%Mapping
for ii=1:length(n) if n(ii)==1;
nn(ii)=3; else
nn(ii)=0; end
end
%Pulse Shaping
i=1;
t=0:0.01:length(n); for j=1:length(t)
if t(j)<=i;
y(j)=nn(i); else
y(j)=nn(i); i=i+1;
end end
%Plotting
plot(t,y,'r-');
axis([0 length(n) -5 5]);
CODE:
%NRZ UNIPOLAR LINE CODING
%INPUT SEQUENCE
n=[1,0,1,0,1];
%Mapping
for ii=1:length(n) if n(ii)==1;
nn(ii)=3; else
Samriddhi Jain 41196202718 T-17
P a g e | 44
nn(ii)=-3; end
end
%Pulse Shaping
i=1;
t=0:0.01:length(n); for j=1:length(t)
if t(j)<=i;
y(j)=nn(i); else
y(j)=nn(i); i=i+1;
end end
%Plotting
plot(t,y,'r-');
axis([0 length(n) -5 5]);
EXPERIMENT NO. 14
AIM: To study & implement ASK & OOK Modulation
THEORY: 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.
CODE:
clc;
close all;
clear all;
x=round (rand (1,10));
t1=0:0.001:0.999;
s=5*sin(2*pi*2*t1);
s1=sin (2*pi*2*t1) ;
ask=[]
for i=1:10
if (x(i)==1)
ask = [ask s]
else
ask = [ask s1]
end
end
subplot (2,1,1)
stairs (0:9, x)
axis([0,10, -0.2,1.2])
subplot (2,1,2);
plot (0:0.001: 9.999, ask);
OUTPUT:
CODE:
clc;
close all;
clear all;
x=round (rand (1,10));
t1=0:0.001:0.999;
s=5*sin(2*pi*2*t1);
s1=sin (2*pi*2*t1);
ask=[]
for i=1:10
if (x(i)==1)
ask = [ask s]
else
ask = [ask zeros(1,1000)]
end
Samriddhi Jain 41196202718 T-17
P a g e | 47
end
subplot (2,1,1);
stairs (0:9, x)
axis([0,10, -0.2,1.2])
subplot (2,1,2);
plot (0:0.001: 9.999, ask);
OUTPUT:
EXPERIMENT NO. 15
AIM: To study & implement FSK using MATLAB
THEORY:
Frequency Shift Keying FSK is the digital modulation technique in which the frequency of the carrier signal
varies according to the digital signal changes. FSK is a scheme of frequency modulation.
The output of a FSK modulated wave is high in frequency for a binary High input and is low in frequency for
a binary Low input. The binary 1s and 0s are called Mark and Space frequencies.
CODE:
clc;
close all;
clear all;
x=round (rand (1,10));
t=0:0.001:0.999;
s=5*sin(2*pi*4.5*t);
s1=5*sin (2*pi*2*t);
ask=[];
psk=[];
for i=1:10
if x(i)==1
ask = [ask s];
else
ask = [ask s1];
end
end;
subplot (2,1,1)
stairs (0:9, x)
xlabel('Time'); ylabel('Amplitude'); axis([0,10,-0.2,1.2]);
subplot(2,1,2); plot(0:0.001:9.999,ask);
xlabel('Time'); ylabel('Amplitude');
OUTPUT:
EXPERIMENT NO. 16
AIM: To study & implement PSK using MATLAB
THEORY:
Phase Shift Keying PSK is the digital modulation technique in which the phase of the carrier signal is
changed by varying the sine and cosine inputs at a particular time. PSK technique is widely used for wireless
LANs, bio-metric, contactless operations, along with RFID and Bluetooth communications.
PSK is of two types, depending upon the phases the signal gets shifted. They are −
1. Binary Phase Shift Keying BPSK
This is also called as 2-phase PSK or Phase Reversal Keying. In this technique, the sine wave carrier takes
two phase reversals such as 0° and 180°.
BPSK is basically a Double Side Band Suppressed Carrier DSBSC modulation scheme, for message being the
digital information.
2. Quadrature Phase Shift Keying QPSK
This is the phase shift keying technique, in which the sine wave carrier takes four phase reversals such as 0°,
90°, 180°, and 270°.
If this kind of techniques are further extended, PSK can be done by eight or sixteen values also, depending
upon the requirement.
CODE:
clc; close all; clear all;
x=round (rand (1,10)); t1=0:0.001:0.999;
s=sin(2*pi*2*t1); s1=-sin (2*pi*2*t1) ; psk=[]
for i=1:10
if (x(i)==1)
psk = [psk s]
else