The document describes experiments performed on digital communication techniques. It includes simulations of modulation schemes like ASK, PSK and FSK. It also includes simulations of quantization techniques like uniform quantization and companding, as well as differential coding schemes like DPCM and DM. Plots of the output signals and SNR calculations are presented for each experiment.
The document describes experiments performed on digital communication techniques. It includes simulations of modulation schemes like ASK, PSK and FSK. It also includes simulations of quantization techniques like uniform quantization and companding, as well as differential coding schemes like DPCM and DM. Plots of the output signals and SNR calculations are presented for each experiment.
S. No Experiment Teachers Sign 1 To evaluate the performance and compute the SNR of Uniform and -law companding quantizer
2 To evaluate the performance of DPCM and DM schemes
3 To perform M-ary ASK/FSK/PSK Modulation 4 Generate four symbols with the given probabilities a = 0.4, b = 0.3, c = 0.2, d = 0.1. Do Huffman Coding and decoding of the signal and compute the data rate compression
5 Generate a random sequence of 0s and 1s. Generate the linear block code, add noise and perform decoding
6 To sample a signal of given amplitude and frequency using Flat top and natural sampling and reconstruct it back at the receiver
7 Convert a sine wave to PCM data stream using PCM encoder and reconstruct it back at the receiver using PCM decoder
8 To observe the effect of limited bandwidth on transmission of digital data
9 To evaluate performance of M-ary ASK/PSF/FSK/QPSK/QAM signal and evaluate its performance in the presence of Additive White Gaussian Noise
3 EXPERIMENT 1 Aim: - To evaluate the performance and compute the SNR of Uniform and -law companding quantizer
[I] Uniform Quantizer
MATLAB Code: -
clear all; clc; N=2000; a=rand(1,N)-0.5; b=a;
for L=3:80 Linv=1/L; for n=1:N c(n)=0; d(n)=0; for j=0:L-1 if ( ( a(n)>(j*Linv-0.5) ) & ( a(n)<((j+1)*Linv-0.5) ) ) b(n)= ((j*Linv-0.5)+((j+1)*Linv-0.5))/2; end; end; end;
0 10 20 30 40 50 60 70 80 0 1000 2000 3000 4000 5000 6000 7000 Quantisation Levels----> S N R - - - - > Uniform Quantizer
[II] -Law Companding Quantizer
MATLAB Code: -
clear all; clc; A = 10000; %Number of values Max =256; %Maximum value with minimum = 0 DATA = Max*rand(1,A); Power=0; for i=1:length(DATA) Power = Power + DATA(i).^2; end Power; u=1; for i=1:length(DATA) b(i)=Max*((log10((DATA(i)/Max)*u+1)) / (log10(1+u))); end T = 100;%Number of maximum levels N = zeros(1,T); for z = 2:T L = z;%Number of levels d = zeros(1,length(b)); Diff = zeros(1,length(b)); M = (max(b))/L; %Interval for i=1:length(b), j=1; 5 while b(i) > (j*M) d(i) = d(i) + M; j = j+1; end end Diff = DATA-d; Noise = 0; for i=1:length(Diff) Noise = Noise + Diff(i).^2; end N(z)=Noise; SNR(z) = Power/N(z); end plot(SNR,'k') xlabel('Number of levels---->'); ylabel('SNR'); title('u Law quantizating');
Output: - 0 10 20 30 40 50 60 70 80 90 100 0 50 100 150 200 250 Number of levels----> S N R u Law quantizating
6 EXPERIMENT 2 Aim: - To evaluate the performance of DPCM and DM schemes.
[I] DPCM (Differential Pulse Code Modulation)
MATLAB Code: - %perform DPCM % 7 level quantizer clear all; clc; N = 100; X = rand(N,1); X = X-1/2; for i = 1:length(X) if(i>3) Xp(i) = 0.3*u(i-1)+0.2*u(i-2)+0.5*u(i-3); %Depends upon past 3 values else Xp(i) = 0; end e(i) = X(i)-Xp(i); if (e(i)>5/12) eq(i) = 3/6; elseif (e(i)>3/12) eq(i) = 2/6; elseif (e(i)>1/12) eq(i) = 1/6; elseif (e(i)>-1/12) eq(i) = 0; elseif (e(i)>-3/12) eq(i) = -1/6; elseif (e(i)>-5/12) eq(i) = -2/6; else eq(i) = -3/6; end u(i)=eq(i)+Xp(i); end plot(1:length(X),X,1:length(u),u) xlabel('x--->'); ylabel('y--->'); title('DPCM'); figure(2) stem(e,eq) xlabel('Vin--->'); ylabel('Vo--->'); title('Transfer Characteristic'); %proceed further QN = 0; 7 SN = 0; for i= 1:length(e) QN = QN + (X(i)-u(i))^2; SN = SN + u(i)^2; end QN = QN/length(QN); SN = SN/length(SN); SNR = SN/QN
Outputs: -
SNR = 12.63
8
[II] DM
MATLAB Code: - %perform DM % 2 level quantizer clear all; clc; N = 100; X = sin(0.05*(1:N)); X = X-1/2;
for i = 1:length(X) if(i>1) Xp(i) = u(i-1); else Xp(i) = 0; end e(i) = X(i)-Xp(i); if (e(i)>0) eq(i) = 1/9; else eq(i) = -1/9; end u(i)=eq(i)+Xp(i); end
0 200 400 600 800 1000 1200 1400 1600 1800 2000 -5 -4 -3 -2 -1 0 1 2 3 4 5 Time---> A m p l i t u d e - - - > FSK
14
[IV] 4-ary ASK
MATLAB Code: -
clc; clear all; n=2; X = rand(20,1); X=X-0.5; Ai = 5; fc = 1000; Tb = 0:.00001:.002;%Bit duration/half symbol duration for i=1:length(X), if X(i)>0 X(i)=1; else X(i)=0; end; if(mod(i,2)==0) for(j = 1:length(Tb)) for(p=1:n) Y(j+(i-p)*length(Tb)) = Ai*(X(i)+2*X(i-1))*sin(2*pi*fc*Tb(j)); end end; end end;
15 Output: - 0 500 1000 1500 2000 2500 3000 3500 4000 -15 -10 -5 0 5 10 15 Time---> A m p l i t u d e - - - > ASK
[V] 4-ary PSK
MATLAB Code: -
clc; clear all; n=2; X = rand(10,1); X=X-0.5; Ai = 5; fc = 1000; Tb = 0:.000001:.002;%Bit duration/half symbol duration for i=1:length(X), if X(i)>0 X(i)=1; else X(i)=0; end; if(mod(i,2)==0) for(j = 1:length(Tb)) for(p=1:n) Y(j+(i-p)*length(Tb)) = Ai*sin(2*pi*fc*Tb(j)+(((X(i)+2*X(i-1)))*pi/2)); end; end end end;
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 x 10 4 -6 -4 -2 0 2 4 6 Time---> A m p l i t u d e - - - > FSK
18 EXPERIMENT 4 Aim: - Generate four symbols with the given probabilities a = 0.4, b = 0.3, c = 0.2, d = 0.1. Do Huffman Coding and decoding of the signal and compute the data rate compression.
Theory: The sampling process is described in time domain. As such it is an operation that is basic to digital signal processing and digital communications. Through use if the sampling process, an analog signal is converted into a corresponding sequence of samples that are usually spaced uniformly in time. Clearly, for such a procedure to have practical utility, it is necessary that we choose the sampling rate properly, so that the sequence of samples uniquely defines the original analog signal. For an analog signal g(t), Naturally Sampled version
In Pulse Amplitude Modulation, the amplitudes of regularly spaced pulses are varied in proportion to the corresponding sample of values of a continuous message signal; the pulses can be of a rectangular form or some other appropriate shape. PAM is similar to natural sampling where the signal is multiplied by a periodic train of rectangular pulses.
Flat Top Sampling
1. Instantaneous sampling of the message signal m(t) every Ts seconds, where the sampling rate fs = 1/Ts is chosen in accordance with the sampling theorem. 2. Lengthening the duration of each sample of each sample so obtained o some constant value T
Process of Flat Top Sampling
25 Observations:
Natural sampling of Sine Wave Flat top sampling of Sine Wave
Natural Sampling at higher sampling frequency Reconstruction of message signal
Input Signal and the Reconstructed Signal
26 EXPERIMENT 7
Aim: - Convert a sine wave to a PCM data stream using PCM encoder and reconstruct the message at the receiver using PCM decoder
Theory: In Pulse Code Modulation, a message signal is represented by a sequence of coded pulses, which is accomplished by representing in discrete form in both time and amplitude. The basic operations performed in the transmitter of a PCM system are sampling, quantizing and encoding, the low pass filter before sampling the signal is used for preventing aliasing of the message signal. The quantizing and encoding operations are usually performed in the same circuit, which is called an analog-to-digital converter. The basic operations in the receiver are regeneration of impaired signals, decoding and reconstruction of the train of quantized samples. When TDM is used, it becomes necessary to synchronize the receiver to the transmitter for the overall system to operate satisfactorily.
Pulse Code Encoding
Pulse Code Decoding
In combining the processes of sampling and quantization, the specification of a continuous message baseband signal becomes limited to a discrete set of values, but not in the form best suited to transmission over a telephone line or radio path. To exploit the advantages of sampling and quantizing for the purpose of making the transmitted signal more robust to noise, interference and other channel impairments, we require use of encoding process to translate the discrete set of values to a more appropriate form of digital signal. Maximum advantage over the effects of noise in a medium is obtained by using a binary code because a binary symbol withstands high level of noise and is easy to regenerate.
27 Observations:
Sampling frequency for PCM Encoder
PCM Encoded Sine Wave
PCM Decoded Sine wave at the receiver and the input sine wave
28 EXPERIMENT 8
Aim: - To observe the effect of limited bandwidth on the transmission of digital data
Theory: In classical model, intelligence moves from transmitter to a receiver over a channel. A number of transmission media can be used for the channel including metal conductors. Regardless of the medium used, all channels have a bandwidth. That is, the medium lets a range of signal frequencies pass relatively unaffected while frequencies outside the range are mode smaller. The issue has important implications. If the mediums bandwidth isnt wide enough some of the sine waves are attenuated and others are lost completely.
Square Wave through a channel through a band limited channel
Bandwidth limiting in a channel can distort digital signals and upset the operation of the receiver. A solution to the problem of limited bandwidth of the channel is to use a transmission medium that has a sufficiently wide bandwidth for the digital data. As digital technology spreads there are demands to push more data down existing channels. To do so without slowing things down requires that the transmission bit rate be increased. This ends up having the same basic effect as reducing the channels bandwidth.
Eye diagrams give us idea about the signals quality and the channels bandwidth. As bandwidth limiting degrades the signals quality the eyes begin to close.
Eye Diagram 29 Observations:
PCM Data with full bandwidth PCM Data with restricted bandwidth using a LPF
Eye Diagram
Restored Digital Signal using Comparator 30 EXPERIMENT 9
Aim: - To generate binary ASK/FSK/QPSK signal and evaluate its performance in the presence of Additive White Gaussian Noise
Theory: Amplitude-shift keying is a form of modulation that represents digital data as variations in the amplitude of a carrier wave. The amplitude of an analog carrier signal varies in accordance with the bit stream (modulating signal), keeping frequency and phase constant. The level of amplitude can be used to represent binary logic 0s and 1s. The simplest and most common form of ASK operates as a switch, using the presence of a carrier wave to indicate a binary one and its absence to indicate a binary zero. This type of modulation is called on-off keying, and is used at radio frequencies to transmit Morse code (referred to as continuous wave operation). More sophisticated encoding schemes have been developed which represent data in groups using additional amplitude levels. For instance, a four-level encoding scheme can represent two bits with each shift in amplitude; an eight-level scheme can represent three bits; and so on. These forms of amplitude-shift keying require a high signal-to-noise ratio for their recovery, as by their nature much of the signal is transmitted at reduced power. Frequency-shift keying (FSK) is a frequency modulation scheme in which digital information is transmitted through discrete frequency changes of a carrier wave. The simplest FSK is binary FSK (BFSK). BFSK literally implies using a pair of discrete frequencies to transmit binary (0s and 1s) information. With this scheme, the "1" is called the mark frequency and the "0" is called the space frequency. Phase-shift keying (PSK) is a digital modulation scheme that conveys data by changing, or modulating, the phase of a reference signal (the carrier wave). Any digital modulation scheme uses a finite number of distinct signals to represent digital data. PSK uses a finite number of phases, each assigned a unique pattern of binary digits. Usually, each phase encodes an equal number of bits. Each pattern of bits forms the symbol that is represented by the particular phase. The demodulator, which is designed specifically for the symbol-set used by the modulator, determines the phase of the received signal and maps it back to the symbol it represents, thus recovering the original data. Alternatively, instead of using the bit patterns to set the phase of the wave, it can instead be used to change it by a specified amount. The demodulator then determines the changes in the phase of the received signal rather than the phase itself. Since this scheme depends on the difference between successive phases, it is termed differential phase-shift keying (DPSK). DPSK can be significantly simpler to implement than ordinary PSK since there is no need for the demodulator to have a copy of the reference signal to determine the exact phase of the received signal (it is a non-coherent scheme). In exchange, it produces more erroneous demodulations. The exact requirements of the particular scenario under consideration determine which scheme is used. 31 Observations:
Digital Signal and its ASK Signal
Input Signal and its Regenerated signal after ASK
Digital Signal and its FSK modulation 32
Demodulated FSK Signal and input signal Cleaned up demodulated signal and input signal
Signal Demodulated from the BPSK version BPSK (Even and Odd bits)