Académique Documents
Professionnel Documents
Culture Documents
DIGITAL
COMMUNICATION
D-14
(THIRD YEAR EXTC )
Lab:-402
Sr. no.
Name of Experiments
1
Measurement of Bit Error Rate using COMMSIM software
2
Measurement of Coding gain (MATLAB) using Cyclic Code (study experiment )
3
Study of QPSK using Digital Storage oscilloscope and find its Bandwidth efficiency
10
11
12
EXEPERIMENT NO:- 1
Now suppose that we want to reduce the power requirement without increasing the error probability
then we have to shift the operating point from point D to point E. This can be done by using the
technique of coding. We define coding gain in this case. Coding Gain can be defined as the reduction
in that can be realized through the use of the code. Coding gain G can be expressed in dB such as
G (dB) = (Eb/N0) u (dB) - (Eb/N0) c (dB).
BER in general depends upon the input-output behaviour. It is related with probability of error by the
following formula
BER = (M-1) Pe
M/2
Conclusion:
Pe = 0.5 erfc ((Eb/N0)0.5)
Here from the practical values we see that as we go on increasing the value of M the probability of
error goes on increasing since the Euclidean distance goes on decreasing. This is also proved by the
theoretical values. However this is not satisfied when we consider the case of BPSK and QPSK.
Also as we increase the value of Eb/N0 the probability of error decreases.
BPSK
QPSK
8PSK
16PSK
EXEPERIMENT:- 2
AIM: Study of cyclic codes and measurement of coding gain
2. Any multiple of the generator polynomial g(D) is a code word polynomial as shown by
x(D)= a(D)g(D)mod(Dn-1) where a(D) is a polynomial in D.
GENERATION OF NON-SYSTEMATIC CODE WORDS:
The non-systematic code words can be obtained by multiplication of message polynomial
with the generator polynomial.
For example, Given that g(D)= 1+ D2
Let the message be 1010.
Therefore, m(D)= 1+ D2 ( from left to right )
The non-systematic code word is then given by,
x(D)=m(D).g(D)
=(1+D2)(1+D2)=1+D2+ D2+D4
=1+ D4
GENERATION OF SYSTEMATIC CODE WORDS:
Step 1: Multiply the message polynomial m(D) by Dn-k to get Dn-km(D).
Step 2: Divide the shifted message polynomial D n-km(D) by the generator
polynomial
g(D) to obtain the remainder b(D).
Step 3: Add the remainder poly. b(D) to the shifted msg. poly. to obtain the code word poly.
x(D).
For example, g(D)= 1+D+ D2
m(D)= 1010
= 1+ D2
Step 1: Dn-km(D)=D3(1+ D2 )
=D3+D5
Step 2: Dn-km(D)
= D3+D5
g(D)
1+D+D2
EQUIPMENTS:
Experimentor Kits ADCL-01.
Connecting chords.
Power supply.
1
2
CIRCUIT DIAGRAM:-
THEORY:
In Binary Phase Shift Keying (BPSK) modulation technique, the modulated output switches between
in-phase and out-of phase component of the carrier for every 'one' to' zero' transitions of modulating
signal. The carrier frequency chosen for BPSK modulation are 500 KHz (0 Degree) and 500KHz
(180 Degree).
CARRIER GENERATOR block on ADCL-01 generates the carrier waves 500 KHz (0 Degree) and
500KHz (180 Degree), which are available at SIN 1 and SIN 2 posts. The BPSK modulator is also
built around the 2 to 1 Analog Multiplexer, which switches between the 500 KHz (0 Degree) and 500
KHz (180Degree) signals for all one to zero transitions occurring in the transmitted data stream.
The phase detector works in the principle of squaring loops. First step in BPSK detection is the sine
to square wave conversion using a Schmitt trigger. This enables the BPSK detector to be built
around digital ICs. The Biphase splitter basically doubles the frequency component of the modulated
data and also ensures that the out of phase component of the modulation signal does not reach the
PLL. The PLL recovers the carrier frequency from the output of the phase splitter, but the frequency
of the recovered carrier is twice that of the transmitted carrier. So a Divide by 2 counters is used to
divide the frequency of the PLL output by 2, thus recovering the reference carrier. The delay flip-flop
is used to compare the phase of the incoming data and the reference carrier thereby recovering the
data.
1
Refer to Block Diagram & Carry out the following connections and switch settings.
Connect power supply in proper polarity to the kit ADCL-01 & switch it on. Select Data
pattern of simulated data using switch SW1.
Connect the NRZ-L DATA output to the control input C1 of the Carrier Modulator logic.
Connect carrier modulated signal MOD OUT on ADCL-01 to the MOD IN of the BPSK
DEMODULATOR.
Observe the BPSK DEMODULATED data at the output of the BPSK DEMODULATOR at b(t)
OUT.
Use RESET switch for clear observation of data output, if recovered data mismatches with
respect to transmitter data.
OBSERVATION:
THEORY : In FSK frequency of the carrier is shifted according to the binary SL(t) = 2Ps cos wL
GENERATION OF BFSK:
The block dig. of BFSK consists of two oscillators which produce carrier frequency fh (640 KHz ) & fL (320
KHz ). The oscillators are applied to the I/p of multipliers (Balanced Modulators ).the other two i/p to the
multiplier are the binary data i/ps Ph (t) [NRZ ] &PL (T) [ NRZ ] inverse .the multipliers o/ps are then added
together to get the BFSK signal . thus when a binary (0 ) is transmitted NRZ= 1 &NRZ INVERSE = 0 &
vice versa .Thus the transmitted signal will either have the frequency Fh or FL.
Here
PL (t)= 1/2+1/2 PL (t )
Where Ph (t) & PL (t ) are bipolar variables which alternate between 1& -1 therefore the spectrum equation
on substitution is given as .
VBSK (t) = Ps/2 cos (wht+ h ]+ Ps/2 cos (wLt+ L]+ Ps/2 wh cos (wht+ h ]+
cos (wLt+ L]
Ps/2 wL
BFSK RECIEVER:
The BFSK receiver consist of two band pass filters one with centre frequency Fh & FL since FH-FL =2fb
the o/ps of the filter do not overlap . The BPF pass their corresponding mains lobes without much distortion
the o/ps of the filters are applied to the envelope detectors are compared by the comparator is used then o/p of
the comparator is the bit sequence b(t )
CIRCUIT DETAILS OF FREQUENCY SHIFT KEYING MODULATION AND DEMODULATION
WITH NOISE.
The FSK Modulation and Demodulation with noise consist of following sections.
1. Digital Data Generator section
2. ASK modulator using Balanced Modulator.
3. Carrier Generator.
4. Adder section.
5. Gaussian Noise Generator Section.
6. Noise Adder section
7. FSK demodulator using PLL detector
8. Integrated & Dump Filter (Matched Filter)
9. Comparator Section
10. Power supply section
Output 2K2 preset is used to vary output level. The outputs are two ASK Modulated signals.
3) RF Carrier Generator section: The function of this section is to generate phase synchronized carrier signal with respect to modulating digital
NRZ input. It converts 640KHz and 320 KHz. TTL Clock signal in to 640KHz and 320KHz. Sine wave
carriers signal using pie filter of lOOuH coil and two 100 Pf capacitors. These signal are given as carrier
signal to balanced modulators as one input.
(4) Adder section: This section adds two input signals with unity gain. This is used to add to ASK signals to converts into FSK
signal.
(5) Gaussian Noise Generator section: Four-transistor circuit is used to generate Gaussian noise signal. The amplitude pot varies its amplitude from
FSK signal.
(6) Noise Adder section: This section adds FSK modulated signal and Gaussian noise signal. The output is Noisy FSK signal.
(7) FSK demodulator: This circuit is based on PLL made of 1C 4046. The free running frequency of PLL is set at 320 KHz value.
Hence when FSK signal having two frequency 320 KHz and 640 KHz is given to it input, it produced
demodulated signal locked to 320 KHz. Hence output is raw data signal. This signal is then given to squarer
circuit.
(8) Integrated & Dump Filter (Matched Filter)
This section integrates the noisy FSK demodulated signal and then it is dumped at bit clock interval at the
output. The output is maximized at bit sampling pulse.
(7) Comparator section;
This Section converts integrated output of Matched filter into pure recovered data using comparator 1C 311.
(6) Power supply section:
The regulated power supply is used for different supply voltages.
Following output D.C. Voltages are required to operate FSK Modulation demodulation system.
+ 15V, 250mA, -15V, 250mA, + 5V, 250mA + 5V, 250mA
Three terminal regulators are used for different output voltages i.e. 1C 7805 for + 5V, 1C 7815 for + 15V, 1C
7915 for-15V, 7905 for-5V
These ICs are supplied different dc input voltages by two Bridge rectifiers consisting of D1-D4 and D5-D8 &
Iwo 1000/25 EC and 1000/10 EC. The capacitors at each input & each output are for filtering purpose.
SIGNAL
1.
NRZ DATA
2.
3.
CARRIER-1
4.
CARRIER-2
5.
BM-1O/P
6.
BM-2 O/P
7.
ADEER O/P
8.
9.
COMP. O/P
CONCLUSION:-
AMPLITUDE
FREQUENCY
Thus according to change in I/p binary data the frequency of the o/p waveform is varied between 320k &640
kHz.
Given that,
P 1 = m1 + m 2 + m 4
P 2 = m1 + m 3 + m 4
P 3 = m 1 + m2 + m 3
P 4 = m 2 + m3 + m 4
The parity matrix is,
P=
[ ]
1
1
0
1
1
0
1
1
1
1
1
0
0
1
1
1
G=
1
1
0
1
1
0
1
1
1
1
1
0
0 1
1 0
1 0
1 0
0
1
0
0
0
0
1
0
0
0
0
1
It is an (8,4) LBC.
n = 8, k=4, p = (n-k) = 4.
G = [ P Ik ] is the parity check matrix.
H=
1
0
0
0
0
1
0
0
0
0
1
0
0 1
0 1
0 1
1 0
1
0
1
1
0
1
1
1
1
1
0
1
Let y be the received code word and x be the transmitted code word.
If e is the error pattern, then
y=x e
yHT = xHT eHT
But, x = MG;
M = [ m1 m2 m3 m4]
yHT = MGHT eHT
but, GHT = 0.
yHT = eHT = Syndrome = S
(1) Given the received codeword,
y1 = 10101010
Consider a single bit error pattern,
1
H = 0
Thus,
yH
= [1 0 1 0 1 0 1 0]
= [ 0 0 1 1] = S1
yH
= [01011100] 0
= [ 0 0 0 0] = S2
By hamming bound,
t
n-k
i=0
Ci
2n-k = 24 = 16
16 8C0 + 8C1 = 9
=> t = 1
Thus, the code can correct an error of 1 bit only.
APPLICATIONS :
(1) Linear block code is used in error correction and detection schemes.
(2) Properties of linear block codes are used in many applications. E.g.
Syndrome-Coset uniqueness property of linear block codes is used in
Trellis shaping, one of the best known in shaping codes. The same
property is used in sensor networks for distributed source coding.
(3) Binary linear codes are ubiquitous in electronic devices and digital storage
media. E.g. Reed Solomon code (a type of linear block codes) is used to
store digital data on a compact disc.
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<math.h>
int d[20][4],x[20][8];
void bin(int i,int n)
{
int j;
for(j=n-1;j>=0;j--)
{
switch( (d[i][j]))
{
case 2:
d[i][j]=0;
d[i][j-1] += 1;
break;
case 3:
d[i][j]=1;
d[i][j-1] += 1;
break;
default:
break;
}
}
}
int code(int n)
{
int k=2,i,j;
for(i=0;i<n-1;i++)
k *= 2;
for(i=0;i<20;i++)
{
for(j=0;j<4;j++)
d[i][j]=0;
x[i][j]=0;
}
d[1][n-1]=1;
//cout<<k;
for(i=2;i<k;i++)
{
for(j=0;j<n;j++)
{
if(j==n-1)
d[i][j] = d[i][j]+d[i-1][j]+1;
else
d[i][j] = d[i][j]+d[i-1][j];
}
bin(i,n);
}
return (k);
}
void main()
{
clrscr();
int f,a,b,n,k,i,j,p[10][10],g[10][10],h[10][10],ht[10][10],y[10],s[10];
cout<<"enter the total no. of bits, n";
cin>>n;
cout<<"enter the no. of msg bits, k";
cin>>k;
for(i=0;i<k;i++)
{
cout<<"\n\n enter the co-efficients for row"<<i+1<<endl;
for(j=0;j<k;j++)
{
cin>>p[j][i];
g[j][i]=p[j][i];
}
}
for(i=0;i<k;i++)
{
for(j=k;j<n;j++)
{
if(j==i+k)
g[i][j]=1;
else
g[i][j]=0;
}
}
cout<<"\n\nG = ";
for(i=0;i<k;i++)
{
cout<<endl<<"\n\t";
for(j=0;j<n;j++)
cout<<g[i][j];
}
a=code(k);
for(i=0;i<a;i++)
{
for(j=0;j<n;j++)
{
for(b=0;b<k;b++)
x[i][j]=x[i][j]^(d[i][b]&g[b][j]);
}
}
int dm=n+1,t=n+1,w;
for(i=1;i<a;i++)
{
if(t<dm)
dm=t;
t=0;
for(j=0;j<n;j++)
t = t+x[i][j];
}
cout<<endl<<"\n\n Dmin =";
cout<<"\t"<<dm;
t=((dm-1)/2);
w=dm-1;
cout<<endl<<"\nThe system can detect upto "<<w<<" errors" ;
cout<<endl<<"\nThe system can correct upto "<<t<<" errors" ;
do
{
cout<<endl<<"\nenter the received code y = ";
for(i=0;i<n;i++)
{
cin>>y[i];
}
for(i=0;i<k;i++)
{
for(j=0;j<k;j++)
{
if(i==j)
h[i][j]=1;
else
h[i][j]=0;
}
}
for(i=0;i<k;i++)
{
for(j=k;j<n;j++)
h[i][j]=p[j-k][i];
}
cout<<"\n\nH = ";
for(i=0;i<k;i++)
{
cout<<endl<<"\n\t";
for(j=0;j<n;j++)
cout<<h[i][j];
}
for(i=0;i<k;i++)
{
for(j=0;j<n;j++)
ht[j][i]=h[i][j];
}
cout<<"\n\nHt = ";
for(i=0;i<n;i++)
{
cout<<endl<<"\n\t";
for(j=0;j<k;j++)
cout<<ht[i][j];
}
for(i=0;i<k;i++)
s[i]=0;
for(i=0;i<k;i++)
{
for(j=0;j<n;j++)
s[i]=s[i]^(y[j]&ht[j][i]);
}
cout<<endl;
cout<<"\nsyndrome =";
for(i=0;i<(k);i++)
cout<< " "<<s[i];
b=0;
for(i=0;i<k;i++)
b += s[i];
if(b==0)
cout<<endl<<"\nThe Rxd. code has no. errors";
else
{
int c=n+1;
b=0;
for(i=0;i<n;i++)
{for(j=0;j<k;j++)
{
if(s[j]==ht[i][j])
b++;
}
if(b==4)
c=i;
b=0;
}
if(c==n+1)
cout<<endl<<"\nThe Rxd. code has more than "<<t<<" errors";
else
cout<<endl<<"\nFrom Syndrome Table "<<c<<" bit is in error";
}
cout<<"\n\n press 1 to continue or 0 to exit";
cin>>f;
}while(f==1);
}
OUTPUT:
enter the total no. of bits,n 8
enter the no. of msg bits, k 4
11101000
10110100
01110010
11010001
Dmin = 4
The system can detect upto 3 errors
The system can correct upto 1 errors
enter the received code y = 1
0
1
0
1
0
1
0
H=
Ht =
10001101
01001011
00101110
00010111
1000
0100
0010
0001
1110
1011
0111
1101
syndrome = 0 0 1 1
The Rxd. code has more than 1 errors
press 1 to continue or 0 to exit0
EXEPERIMENT:- 6
CONSTELLATION DAIGRAM AND BANDWIDTH EFFICIENCY OF QAM
AIM:
EQUIPMENT:
CONSTELLATION DIAGRAM
BLOCK DIAGRAM FOR OBSERVATION OF CONSTELLATION DIAGRAM
The constellation diagram or geometrical representation is as shown in fig.1 below. The
points in signal space corresponding to each of the eight possible Transmitted signals
are indicated by dots. For each such signal we can recover three bits rather than one.
The distance of a signal point from the origin is (Es)^1/2 which is the square root of the
signal energy associated with the symbol, that is Es=Ps * Ts = Ps(2Tb). As we know the
ability to determine a bit without error is measured by the distance in signal space
between points corresponding to the different values of the bit. We note from fig. that
points
Which differ in a single bit are separated by the distance d = 2(Ps)^1/2 Tb =2(Eb)^1/2
where Eb is the energy contained in a bit transmitted for a time Tb. This distance for
QPSK is the same as for BPSK.
Hence, altogether, we have the important result that, in spite of the reduction by a
factor of two in the bandwidth required by QPSK in comparison with BPSK, the noise
immunity of the two systems are the same. The number of dot points appearing in the
constellation diagram depends on the number of symbol generated due to I, Q and C
bit. The position of dot points in the quadrant of the constellation diagram is also
depends on the symbol Generated due to the I, Q and C bit as shown above. The fig.2
shows examples of constellation diagram. In diagram the data pattern used is
111001010011100101110000. If we plot the expected data pattern of I, Q and C bit as
shown in fig.2, then there are 8 symbols generated as 000, 001, 010, 011, 100, 101,
110, 111 thus there are 8 dots appearing in the constellation diagram in all four
quadrants. Bandwidth efficiency of QAM is defined by the ratio of bit transmission
speed in QAM to Bandwidth of QAM signal. It is given by
Bandwidth Efficiency = Fb / Bw
Where, Fb is Bit transmission speed and
Bw is the bandwidth of signal transmitted.
The more the bandwidth efficiency more is the data transfer within the same bandwidth
of signal transmission.
PROCEDURE:
(A)Study of constellation diagram.
Refer to the block diagram and carry out the following connections and Switch settings.
Connect power supply in proper polarity to the kit ADCL-05 and ADCL-06 switch it on.
Select Data pattern of simulated data using switch SW1, SW2, SW3.
Connect SDATA generated to DATA IN of NRZ-L CODER.
Connect the NRZ-L coded data at DATA OUT to the DATA IN of the TRIBIT CODER.
Connect the clock generated SCLOCK to CLK IN of TRIBIT CODER.\
Connect the Tribit data I BIT, Q BIT & C BIT to control input C1, C2 and C3 of CARRIER
MODULATOR respectively.
Connect sine carrier to input of CARRIER MODULATOR as follows:
SIN 1 to IN 1.
SIN 2 to IN 2.
SIN 3 to IN 3.
SIN 4 to IN 4.
Connect QAM modulated signal MOD OUT on ADCL-05 to the MOD IN of the QAM
DEMODULATOR on ADCL-06.
Output of second squarer at SQUARER 1
Output of second squarer at SQUARER 2
Recovered carrier of 2 MHz at PLL
Four sampling clocks at the output of Sampling Clock Generator
Two added outputs at the output of ADDER
Connect I BIT, Q BIT & C BIT outputs of QAM Demodulator to I BIT IN, Q BIT IN & C
BIT IN posts of Data Decoder.
Put switch SW3 on QAM mode.
Similarly we can observe the constellation diagram for DQAM. For this
Follow the procedure no 4, and then connect X & Y port of constellation block to X-channel
and Y-channel of CRO respectively.
Observe the decoded data at DATA OUT post of data decoder. Compare the decoded data with
SDATA on ADCL-05.
Now connect X & Y port of CONSTELLATION BLOCK to X-channel and Y-channel of
CRO respectively.
(B)Bandwidth efficiency of QAM technique.
Tribit coded data I BIT, Q BIT & C BIT at the output of tribit coder.
ON KIT ADCL-06.
DETECTORS.
Recovered NRZ-L data from I & Q bits at the output of DATA DECODER.
CONCLUSION:
It is observed from the constellation diagram that, the symbol generated due to I bit, Q
bit & C bit have eight possible values and lies in four quadrants. Also from the
constellation diagram we can determine the distance between the two symbols. The
transmitted signal, if it changes, changes phase by 90 deg. Rather than by 180 deg. as
in BPSK. Bandwidth Efficiency generally depends on the number of bits transmitted
simultaneously.
EXEPERIMENT:- 7
OBSERVATION OF THE CONSTELLATION DAIGRAM FOR I & Q DATA BITS.
AND STUDY OF BANDWIDTH EFFICIENCY OF QPSK.
OBJECTIVE:
EQUIPMENT:
CIRCUIT DIAGRAM:-\
THEORY
The constellation diagram or geometrical representation is as shown in fig 1.below the points in
signal space corresponding to each of the four possible transmitted signal is indicated by dots. For
each such signal we can recover two bits rather than one. The distance of a signal point from the
origin is (Es)^1/2 which is the square root of the signal energy associated with the symbol, that is
Es=Ps * Ts = Ps(2Tb). As we know the ability to determine a bit without error is Measured by the
distance in signal space between points corresponding to the different values of the bit. We note
from fig. that points which differ in a single bit are separated by the distance d = 2(Ps)^1/2 Tb = 2
(Eb)^1/2 where Eb is the energy contained in a bit transmitted for a time Tb. This distance for
QPSK is the same as for BPSK.
Hence, altogether, we have the important result that, in spite of the reduction by a factor of two in the
bandwidth required by QPSK in comparison with BPSK, the noise immunity of the two stems are the
same. The number of dot points appearing in the constellation diagram depends on the number of
symbol generated due to I and Q bit. The position of dot points in the quadrant of the constellation
diagram is also depends on the symbol generated due to the I and Q bit as shown above. The fig
below shows some examples of different constellation diagram.
In fig.2 the data pattern used is 01011010. if we plot the expected data pattern of I and Q bit as
shown in fig 2 , then there are 4 symbol generated as 01,11,10 and 00. thus there are 4 dots
appearing in the constellation diagram in all four quadrant.
Bandwidth efficiency of QPSK is defined by the ratio of bit transmission speed in QPSK to
Bandwidth of QPSK signal. It is given by
Bandwidth Efficiency = Fb / Bw
Where, Fb is Bit transmission speed and
Bw is the bandwidth of signal transmitted.
The more the bandwidth efficiency more is the data transfer within the same bandwidth of signal
transmission.
PROCEDURE:
Refer to Block Diagram & Carry out the following connections and switch Settings
Connect power supply in proper polarity to the kit ADCL-02/03 & switch it on.
Select Data pattern of simulated data using switch SW1.
Connect SDATA generated to DATA IN of NRZ-L CODER.
Connect the coded data NRZ-L DATA to the DATA IN of the DIBIT CONVERSION.
Connect the clock generated SCLOCK to CLK IN of DIBIT CONVERSION
Observe the coded signal I bit & Q bit on oscilloscope.
8)Connect I bit to X-channel of CRO & Q bit to Y-channel of CRO.
Put the CRO in X-Y mode.
10)Observe the constellation diagram on oscilloscope as shown in the block diagram and
refer theory to observe different types of constellation diagram.
11) Observe the constellation diagram for DQPSK modulation also by
referring connection of DQPSK from experiment no.2.
CONCLUSION:
It is observed from the constellation diagram that, the symbol generated due to I bit & Q bit have four
possible values and lies in four quadrants. Also from the constellation diagram we can determine the
distance between the two symbols and can conclude that after each time Tb either be or bo (i.e. I or
Q bit) can change, but both cannot change at the same time. After each time Tb, the transmitted
signal, if it changes, changes phase by 90 deg. rather than by 180 deg. as in BPSK.
Bandwidth Efficiency generally depends on the number of bits transmitted simultaneously.
The above equation will be satisfied provided it is arranged, with m and n integers, that
2 * (fH fL) * Tb = n
and
2 * (fH + fL) * Tb = m
and
fL = fo - (fb/4)
fo = (m/4) * fb
The above equation shows that since n=1, fH and fL are as close together as possible for orthogonality
to prevail. It is for this reason that the system is called Minimum Shift Keying. Equation shows that
frequency fo is an integral multiple of fb/4. Thus
fH = (m + 1) * (fb/4)
and
fL = (m 1) * (fb/4)
-Tb t Tb
= ot + bo(t)be(t)t
And
+(t) = (o + )t
; bo(t) * be(t) = +1
-(t) = (o - )t
; bo(t) * be(t) = -1
DEMERITS:
Complicated.
Bandwidth= 1.5fb
(m=0,1,2,..M-1)
m = (2m + 1) * /M
Considering orthonormal waveforms as coordinate axes the transmitted signal is
Vm= [(2Ps) * cosm] * cos ot [(2Ps)* sinm] * sin ot
Now defining po and pe by
Po= (2Ps) * sinm
Pe= (2Ps) * cosm
Hence the equation becomes
Vm= Pe * cos ot Po * sin ot
where both Pe and Po change every NTb=Ts and can assume any of M possible values.
CONSTELLATION DIAGRAM
MQASK
In MPSK we transmit, in any symbol interval, one signal or another which are distinguished from one
another in phase but all are of same amplitude. However MQASK is a system wherein the signal
vectors differ not only in their phase but also in their amplitude. It involves direct modulation of
carriers in quadrature.
A typical signal can be represented as
VQASK = ki{[(2Ps) * cosm] * cos ot [(2Ps)* sinm] * sin ot }
where i = 0 to 3.
Where we have considered orthonormal waveforms as coordinate axes.
CONSTELLATION DIAGRAM
COMPARISON
The advantage of using the amplitude and phase shift varying system as the description suggests is
that we are able to improve the noise immunity of the system.
Hence the noise immunity of a MQASK system is always better as compared to a MPSK system
considering the same no. of bits clubbed together.
Also the MQASK system has a lower error rate as compared to its MPSK counterpart.
The distance between signals is greater for MQASK when compared.
However the bandwidth remains the same for both.Also the type of receiver used are same.
Thus considering all these factors we can say that MQASK system is better than its MPSK
counterpart.
EXEPERIMENT:- 10
AIM: To study Huffman coding
THEORY:
The Huffman code is a source code whose average word length approaches the fundamental
limit set by the entropy of a discrete memory less source namely H.The Huffman code is
optimum in the sense that no other decodable set of code-words has a smaller average codeword length for a given discrete memory less source. The essence of the algorithm used to
synthesize the code is to replace the prescribed set of source statistics of a discrete memory
less source with a simpler one. This reduction process is continued in a step-by-step manner
until we are left with a final set of source statistics (symbols) of only two, for which (0,1) is
an optimal code. Starting from this trivial code, we then work backward and thereby construct
an optimal code for a given source
Where p0,p1,..pk-1 are the source statistics and lk is the length of the code-word assigned to the
source symbol sk. It is usually found that when a combined symbol is as high as possible, the
resulting Huffman code has a significantly smaller variance than when it is moved as low as
possible. On this basis, it is reasonable to choose the former Huffman code over the latter.
APPLICATIONS:
1. Arithmetic coding can be viewed as a generalization of Huffman coding, in the sense that
they produce the same output when every symbol has a probability of the form 1/2 k; in
particular it tends to offer significantly better compression for small alphabet sizes.
2. Huffman coding today is often used as a "back-end" to some other compression methods.
DEFLATE (PKZIP's algorithm) and multimedia codecs such as JPEG and MP3 have a
front-end model and quantization followed by Huffman coding.
HUFFMAN PROGRAM:
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
typedef struct que* queueptr;
typedef queueptr treeptr;
typedef struct que
{
float v;
int id;
char cd[10];
queueptr next;
queueptr prev;
treeptr rs;
treeptr ls;
treeptr f;
}queue;
queue el1;
queueptr front=&el1;
queueptr rear=front;
queueptr *storage;
int c=0;
void insert(queueptr,int);
void addend(queueptr);
void addfront(queueptr);
void add(queueptr,queueptr);
void gencd(queueptr);
void disp();
void main()
{
clrscr();
int n,m;
cout<<"n=";
cin>>n;
m=n;
//cout<<" xx "<<front;
*storage=front;
c++;
queueptr l,l1,l2;
l1=front;
cout<<"enter probabilities\n";
cout<<"m1\t";
cin>>front->v;
float s;
s=(front->v);
front->id=1;
front->next=NULL;
front->prev=NULL;
for(int i=2;i<=n;i++)
{
l=(queueptr)malloc(sizeof(queue));
l->id=i;
cout<<"m"<<i<<"\t";
cin>>l->v;
s=s+(l->v);
l->rs=NULL;
l->ls=NULL;
l->f=NULL;
l->prev=NULL;
l->next=NULL;
*(storage+c)=l;
c++;
l1=l;
//cout<<l<<endl;
strcpy(l->cd," ");
insert(l,i);
}
//if(s!=1)
//return;
while(n>2)
{
l=(queueptr)malloc(sizeof(queue));
l1=rear;
l2=rear->prev;
l1->prev=NULL;
l2->next=NULL;
rear=l2->prev;
rear->next=NULL;
l->rs=l1;
l->ls=l2;
l1->f=l;
l2->f=l;
l->f=NULL;
l->v=l1->v + l2->v;
n--;
insert(l,n);
}
strcpy(front->cd,"0");
front=front->next;
strcpy(front->cd,"1");
gencd(l);
cout<<"\n\n\ncodes\n";
for(i=0;i<m;i++)
{
l=*(storage);
//cout<<l<<endl;
cout<<"m"<<i+1<<"\t";
storage++;
printf("%6s",(l->cd));
cout<<endl;
}
getch();
}
void addend(queueptr l)
{
rear->next=l;
l->prev=rear;
l->next=NULL;
rear=l;
}
void add(queueptr l,queueptr l1)
{
l->next=l1;
l->prev=l1->prev;
l1->prev=l;
l->prev->next=l;
}
void addfront(queueptr l)
{
l->next=front;
front->prev=l;
l->prev=NULL;
front=l;
}
void insert(queueptr l,int i)
{
int k=1;
queueptr l1;
l1=front;
while(l->v <= l1->v)
{
k++;
l1=l1->next;
}
if(k==i)
{
addend(l);
}
else if(k==1)
{
addfront(l);
}
else
{
add(l,l1);
}
}
void disp()
{
queueptr l=front;
while(l!=NULL)
{
cout<<l->id<<"\t"<<l->v<<endl;
l=l->next;
}
}
void gencd(queueptr l)
{
queueptr l1,l2;
if(l->ls==NULL)
{
return ;
}
l1=l->ls;
l2=l->rs;
strcpy(l1->cd,l->cd);
strcat(l1->cd,"0");
strcpy(l2->cd,l->cd);
strcat(l2->cd,"1");
gencd(l1);
gencd(l2);
}
Output:
n=5
enter probabilities
m1
.5
m2
.25
m3
.125
m4
.0625
m5
.0625
codes
m1
0
m2
10
m3
110
m4
1110
m5
1111
Null pointer assignment
Study of Equalizers
AIM :- Study of Equalizers (Study Exeperiment)
EQUALISER
M=4;
x=randint(2000,1,M);
y=pskmod(x,M);
trainlen=100;
channel=[0.95;0.4;0.3;0.1+0.2i];
yr=filter(channel,1,y);
eq1=lineareq(8,lms(0.01));
eq1.SigConst=pskmod([0:M-1],M);
[symbolest,yr_eq]=equalize(eq1,yr,y(1:trainlen));
h=scatterplot(yr,1,trainlen,'bx');
hold on;
scatterplot(symbolest,1,trainlen,'g.',h);
scatterplot(eq1.SigConst,1,0,'r*',h);
legend('Filtered Signal','Equalized Signal','Ideal signal constellation');
hold off;
xr_noeq=pskdemod(yr,M);
xr_eq=pskdemod(yr_eq,M);
[ne_noeq,er_rate_noeq]=symerr(xr_noeq(trainlen+1:n),x(trainlen+1:n));
[ne_eq,er_rate_eq]=symerr(xr_eq(trainlen+1:n),x(trainlen+1:n));
yl=qammod(x,M);
%modulation
yln=awgn(yl,10,'measured');
%SNR of 10dB
scatterplot(yln);
%constelaation diagram
ylr=qamdemod(yln,M);
%demodulation
[num_error,er_rate]=symerr(x,ylr);
y2n=awgn(y1,5,'measured');
%SNR of 5dB
scatterplot(y2n);
%constellation digram
y2r=qamdemod(y2n,M);
%demodulation
[num_error,er_rate]=symerr(x,y2r);