EC 8561 CS Lab Manual
EC 8561 CS Lab Manual
TOTAL: 45 PERIODS
                                                   2
           EC8561 – COMMUNICATION SYSTEMS LABORATORY
          GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
                              LIST OF EXPERIMENTS
S.NO   DATE      NAME OF THE EXPERIMENT                PAGE   MARKS    SIGNATURE
                                                        NO
 1            Signal Sampling and reconstruction
                                             3
                  EC8561 – COMMUNICATION SYSTEMS LABORATORY
                 GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
EX.NO.1       SAMPLING AND RECONSTRUCTION OF ANALOG SIGNAL                                 DATE:
   AIM:
   To perform the signal sampling and Reconstruction of the Analog signal.
   APPARATUS REQUIRED:
       1. VCT- 23 Kit
       2. Patch Cord
       3. Probe
       4. CRO
   THEORY:
           A band limited signal of finite energy has no frequency components higher than ‘W’
   hertz is completely described by specified the values of the signal of instants of time separated by
   1/2W seconds, where ‘W’ is the higher frequency content. The zero order hold circuit is used for
   practical reconstruction. It simply hold the value x(n) for ‘T’ seconds . Here ‘T’ is the sampling
   period; The output of zero order hold is stair case signal. The reconstructed signal is the
   succession of sinc pulses weighted by x(nTs) these pulses are interpolated with the help of a
   LPF. It is also called reconstruction filter or interpolation filter Natural sampling is chopper
   sampling because the waveform of the sampled signal appears to be chopped off from the
   original signal waveform. The top of the samples remains constant and equal to instantaneous
   value of x(t) at start of sampling fs
   = 1/Ts
   PROCEDURE:
     1. Connect the main plug in to the main board. Keep the power switch in OFF position.
     2. Put the duty cycle selector switch in position 50%
     3. Link 25 Hz sine wave output to analog input.
     4. Turn on the trainer.
     5. Turning on the trainer select 250 Hz sampling rate by default.
     6. Display 25Hz sine wave and sampled output on t oscilloscope. This display shows 25Hz
         sine wave being sampled at 200 Hz there are 10 samples for every cycle of the sinewave.
     7. Link the sample output to the fourth order low pass filter display sample output and
         output of the filter in the oscilloscope. The display shows the reconstructed original 21
         Hz sine wave.
     8. We had used sampling frequency greater than twice the maximum input frequency.
     9. Remove the line from 25KHz sine wave output to the modulating input.
     10. By successive process of frequency selector switch change the sampling frequency 32
         KHz, 16KHz, 8 KHz,4 KHz,2 KHz,1 KHz,50 Hz and back to 250 Hz
     11. Observe how sample output changes in each cases and how the lower sampling
         frequencies introduce distortion in to the filter output waveform. This is due to the fact
         that the filter does not attenuate the unwanted next frequency component significantly use
         of higher order filter would improve the output waveform.
                                                     4
         EC8561 – COMMUNICATION SYSTEMS LABORATORY
        GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
TABULATION
                               5
                EC8561 – COMMUNICATION SYSTEMS LABORATORY
               GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
      2. So far we have used sampling frequencies greater than twice the maximum input
          frequency. To set the nquist criteria set sampling rate 4 Hz 50% duty cycle.
      13. Remove the link 25 Hz sine wave output to the modulating input.
      14. Connect the link from 250 Hz or 500 Hz sine wave output to the modulating input and
      link the sampled output to fourth order LPF. Display sample output and output of the filter on
      the oscilloscope. The display shows the reconstruction signal 250 Hz or 500 Hz sine wave.
      15. Now decrease the sampling rate to 32 KHz and then to 500 Hz. Observe the distortedfact
     that we under sampled the input waveform overlooking the nyquist criteria and thus the
     output was distorted even though the signal below the cutoff frequency of the filter. This is
     also describes the phenomenon of aliasing.
  RESULT
  Thus the signal sampling and reconstruction techniques was performed and graph was plotted
                                                   6
                      EC8561 – COMMUNICATION SYSTEMS LABORATORY
                     GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
EX.NO .2              TIME DIVISION MULTIPLEXING (TDM)                                   DATE:
     AIM:
                To understand and to study TDM of signals.
APPARATUS REQUIRED:
     THEORY:
     TDM:
          Time division multiplexing (TDM) is the process of sending more than one source
     information over a same channel in different time slot which helps in efficient channel utilization
     and saves bandwidth. Time-division multiplexing (TDM) is a type of digital or (rarely) analog
     multiplexing in which two or more signals or bit streams are transferred apparently
     simultaneously as sub-channels in one communication channel, but are physically taking turns on
     the channel. The time domain is divided into several recurrent timeslots of fixed length, one for
     each sub-channel. A sample byte or data block of subchannel 1 is transmitted during timeslot 1,
     sub-channel 2 during timeslot 2, etc. One TDM frame consists of one timeslot per sub-channel.
     After the last sub-channel the cycle starts all over again with a new frame, starting with the
     second sample, byte or data block from sub-channel 1. It's often practical to combine a set of
     low-bit-rate streams, each with a fixed and pre-defined bit rate, into a single high-speed bit
     stream that can be transmitted over a single channel. This technique is called time division
     multiplexing (TDM) and has many applications, including wire line telephone systems and some
     cellular telephone systems. The main reason to use TDM is to take advantage of existing
     transmission lines. It would be very expensive if each low-bit-rate stream were assigned a costly
     physical channel (say, an entire fiber optic line) that extended over a long distance.
                                                       7
              EC8561 – COMMUNICATION SYSTEMS LABORATORY
             GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
PATCHING DIAGRAM-TDM
PROCEDURE:
    1. Switch ON the power supply to the board
    2. Display the multiplexed signal at testpoint T14 on channel 1 and 250Hz sinewave at test point
       T2 on channel 2 of CRO note down waveform
    3. Display 500Hz sine wave at testpoint T3 on channel 2 in place of 250Hz identify
       sampled version of this sinewave in TDM signal and note down
    4. Similarly observe 1KHz and 2KHZ waveforms at testpoints T4 and T5 respectively on
       oscilloscope and notedown
    5. Display the TDM waveform(T14) on channel 1 and channel synchronization
       signal (T13) on channel 2 of CRO and note down the waveforms
    6. Display 250KHz sinewave at T2 on channel 1 and output sinewave at T16 on channel 2 of CRO
       note down waveform
                                                8
              EC8561 – COMMUNICATION SYSTEMS LABORATORY
             GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
RESULT:
Thus the time division multiplexed outputs are observed and studied.
                                               9
                      EC8561 – COMMUNICATION SYSTEMS LABORATORY
                     GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
EXP.NO.; 3     AMPLITUDE MODULATION AND DEMODULATION                                 DATE:
AIM:
APPARATUS REQUIRED:
     MODULATION THEORY:
             Modulation is defined as the process by which some characteristics of a carrier signal is
     varied in accordance with a modulating signal. The base band signal is referred to as the
     modulating signal and the output of the modulation process is called as the modulation signal.
             Amplitude modulation is defined as the process in which is the amplitude of the carrier
     wave is varied about a means values linearly with the base band signal. The envelope of the
     modulating wave has the same shape as the base band signal provided the following two
     requirements are satisfied
             The carrier frequency fc must be much greater than the highest frequency components fm
     of the message signal m (t)
                                i.e. fc >>fm
             The modulation index must be less than unity. if the modulation index is greater than
     unity, the carrier wave becomes over modulated.
     DEMODULATION THEORY:
           The process of detection provides a means of recovering the modulating Signal from
     modulating signal. Demodulation is the reverse process of modulation. The detector circuit is
     employed to separate the carrier wave and eliminate the side bands. Since the envelope of an AM
     wave has the same shape as the message, independent of the carrier frequency and phase,
     demodulation can be accomplished by extracting envelope.
     PROCEDURE:
       1. Switch ON the power supply
        2. Make wiring connection on VCT-26 as shown in patching diagram
        3. Set the carrier signal frequency to be 25khz
        4. Check the modulating signal frequency varies from 100hz to 1.5khz at modulating signal
           output P2 by varying POT3
        5. Connect the carrier signal output P1 to carrier signal input P4 of modulator
        6. Connect the modulating signal output P2 to modulating signal input P5 of modulator
        7. Display the AM wave at CRO and notedown the readings
        8. Convert the modulated output P7 to demodulated input P9 of demodulator
        9. Observe the amplified demodulated ouput at testpoint P13
                                                      10
             EC8561 – COMMUNICATION SYSTEMS LABORATORY
            GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
PATCHING DIAGRAM -AM MODULATION
                                    11
                  EC8561 – COMMUNICATION SYSTEMS LABORATORY
                 GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
MODEL GRAPH
  TABULATION:
                       Amplitude in    Time          Frequency
                       volts           period
Message signal
Carrier signal
Modulated signal
Demodulated signal
RESULT:
                                                12
                  EC8561 – COMMUNICATION SYSTEMS LABORATORY
                 GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
    AIM:
           To perform Frequency modulation technique.
    APPARATUS REQUIRED:
           1. Frequency modulation kit
           2. CRO
           3. Probe
           4. Patch cord
    THEORY:
             Frequency modulation is a process of changing the frequency of a carrier wave in
    accordance with the slowly varying base band signal. The main advantage of this modulation is
    that it can provide better discrimination against noise.
    PROCEDURE:
       1. Switch ON the power supply
12. Observe the demodulated ouput and then compare with the original input
                                                   13
             EC8561 – COMMUNICATION SYSTEMS LABORATORY
           GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
PATCHNG DIAGRAM FM MODULATOR
                                  14
                  EC8561 – COMMUNICATION SYSTEMS LABORATORY
                 GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
MODEL GRAPH
  TABULATION:
                       Amplitude in    Time          Frequency
                       volts           period
Message signal
Carrier signal
Modulated signal
Demodulated signal
RESULT:
                                                15
                          EC8561 – COMMUNICATION SYSTEMS LABORATORY
                         GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
EX.NO.; 5          PULSE CODE MODULATION AND DEMODULATION                                        DTAE:
  Aim:
    To perform Pulse code Modulation and demodulation and to plot the waveform forbinary data at different
    frequencies
Apparatus Required:
                    1.   PCM kit
                    2.   CRO
                    3.   Probe
                    4.   Patch cord
THEORY:
      Procedure:
      1.    Make wiring connection on VCT-07 as shown oin figure / simply connect the test points P! to P8 and P21 to P22 using
            patch card
      2.    Ensure all the switches in switched faults block in OFF position and potentiometers POT1 and POT@ in
            minimum position
      3.    Keep 87Khz of sampling rate
      4.    Display the modulating signal at test point P1 using CRO probe. Increase the sinewave amplitude by rotating POT1 in
            clockwise directions and set sinewave amplitude and note down
      5.    Display the sample and hold ouput waveform on CRO and note down the waveform
      6.    Observe the recovered waveform at test point P34 note down the waveform
                                                                16
           EC8561 – COMMUNICATION SYSTEMS LABORATORY
          GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
TABULATION
MODULATED
SIGNAL
DEMODULATED
SIGNAL
                                17
               EC8561 – COMMUNICATION SYSTEMS LABORATORY
              GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
MODEL GRAPH
RESULT
Thus the Pulse Code Modulation and Demodulation was performed and output is verified
                                               18
                  EC8561 – COMMUNICATION SYSTEMS LABORATORY
                 GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
AIM:
APPARATUS REQUIRED:
            1.   DM kit
            2.   CRO
            3.   Probe
            4.   Patch cord
THEORY:
Delta Modulation is a form of pulse modulation where a sample value is represented as a single
bit. This is almost similar to differential PCM, as the transmitted bit is only one per sample just to
indicate whether the present sample is larger or smaller than the previous one. The encoding,
decoding and quantizing process become extremely simple but this system cannot handle rapidly
varying samples. This increases the quantizing noise.
PROCEDURE:
                                                   19
          EC8561 – COMMUNICATION SYSTEMS LABORATORY
        GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
PATCHING DIAGRAM- DM MODULATION &DEMODULATION
                               20
             EC8561 – COMMUNICATION SYSTEMS LABORATORY
            GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
TABULATION
MODEL GRAPH
RESULT
Thus the Delta modulation and demodulation were performed and graphs were
plotted.
                                             21
                 EC8561 – COMMUNICATION SYSTEMS LABORATORY
                GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
  AIM :
          To perform different line coding schemes.
  APPARATUS REQUIRED:
      1. VCT -37 trainer kit
      2. Patch chords.
      3. CRO
  THEORY:
          We need to represent PCM binary digits by electrical pulses in order to transmit them
  through a base band channel. The most commonly used PCM popular data formats are being
  realized here. Line coding refers to the process of representing the bit stream (1‟s and 0‟s) in the
  form of voltage or current variations optimally tuned for the specific properties of the physical
  channel being used. The selection of a proper line code can help in so many ways: One
  possibility is to aid in clock recovery at the receiver. A clock signal is recovered by observing
  transitions in the received bit sequence, and if enough transitions exist, a good recovery of the
  clock is guaranteed, and the signal is said to be self-clocking.
  Some common types of line encoding in common-use nowadays are unipolar, polar, bipolar,
  Manchester and Duobinary encoding.
  PROCEDURE
    1. Connect the PRBS (test point P5) to various line coding formats. Obtain the coded
       output as per the requirement.
    2. Connect coded signal test point to corresponding decoding test point as inputs.
    3. Set the SW1 as per the requirement.
    4. Set the potentiometer P1 in minimum position.
    5. Switch ON the power supply. Press the switch SW2 once.
    6. Display the encoded signal and decoded signal on the CRO.
                                                    22
            EC8561 – COMMUNICATION SYSTEMS LABORATORY
           GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
PATCHING DIAGRAM-UNIPOLAR RZ
PATCHING DIAGRAM-POLAR RZ
                                 23
             EC8561 – COMMUNICATION SYSTEMS LABORATORY
            GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
PATCHING DIAGRAM-BIPOLAR RZ
                                  24
            EC8561 – COMMUNICATION SYSTEMS LABORATORY
           GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
PATCHING DIAGRAM-MANCHESTER
                                 25
          EC8561 – COMMUNICATION SYSTEMS LABORATORY
         GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
TABULAR COLUMN
 S.No Name of the signal    Amplitude in V Time period in      Amplitude in   Time period in
                                           Sec                 V              Sec
 1
RESULT
                                              26
                      EC8561 – COMMUNICATION SYSTEMS LABORATORY
                   GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
EX.NO.8          ASK, FSK AND PSK SIMULATION USING MATLAB                  DATE:
AIM:
APPARATUS REQUIRED:
          4. Computer
          5. Matlab software Version 2013b
PROCEDURE:
MATLAB CODING:
                                                       27
             EC8561 – COMMUNICATION SYSTEMS LABORATORY
            GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
   axis([1 10 -2 2]);
   subplot(3,1,2);
   plot(t,fsk);
   xlabel('time')
   ylabel('amplitude')
   title('frequency shift keying')
   hold on;
   grid on;
   axis([1 10 -2 2]);
   subplot(3,1,3);
   plot(t,psk);
   xlabel('time')
   ylabel('amplitude')
   title('Phase shift keying')
   hold on;
   grid on;
   axis([1 10 -2 2]);
   i=i+1;
   end
      MODEL OUTPUT
RESULT:
The simulation of ASK FSK and PSK were done using MATLAB and the outputs were
recorded.
                                          28
               EC8561 – COMMUNICATION SYSTEMS LABORATORY
             GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
 EX.NO.;9 Simulation of DPSK, QPSK and QAM generation schemes DATE:
AIM:
APPARATUS REQUIRED:
      6. Computer
      7. Matlab software Version 2013b
PROCEDURE:
      MATLAB CODING
      DPSK
%dpsk
clc;
clear all ;
close all;
%input bits
b=[1 0 1 1 0 1 ];
N=6;
%differential encoding
d=1;%initial bit
dc=[];
for i=1:length(b)
      dc=[dc d];
    d= not(xor(d,b(i)));
end
    dc=[dc d];
%bit to symbol mapping
for ii=1:length(dc)
     if dc(ii)==1;
         nn(ii)=1;
     else
          nn(ii)=-1;
     end
end
%pulse shaping
S=100;
i=1;
t=0:1/S:length(dc);
for j=1:length(t)
     if t(j)<=i;
         m(j)=nn(i);
     else
          m(j)=nn(i);
                                                   29
                EC8561 – COMMUNICATION SYSTEMS LABORATORY
               GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
 i=i+1;
     end
end
%plot
subplot(411);
plot(t,m,'k-');
xlabel('time');
ylabel('amplitude');
title('polar signal');
%%carrier
c=cos(2*pi*2*t);
subplot(412);
plot(t,c,'k-');
xlabel('time');
ylabel('amplitude');
title('carrier signal');
%dpsk modulation
x=m.*c;
subplot(413);
plot(t,x,'k-');
xlabel('time');
ylabel('amplitude');
title('bpsk signal');
%coherent detection
y=x;
y1=y.*c;%product modulator
subplot(414);
plot(t,y1,'k-');
xlabel('time');
ylabel('amplitude');
title('dpsk detection signal');
int_op =[];
for ii=0:S:length(y1)-S;
     int_op=(1/S)*trapz(y1(ii+1:ii+S));
     int_op =[int_op int_op];
end
%harddetection
det=(round(int_op,1)>=0);
%diffenetial detection
for ii=1:length(det)-1
     if det(ii)==det(ii+1);
          op(ii)=1;
     else
          op(ii)=0;
     end
end
disp('diffenetial detection')
op
QPSK
% QPSK Modulation
clc;
clear all;
close all;
%GENERATE QUADRATURE CARRIER SIGNAL
Tb=1;t=0:(Tb/100):Tb;fc=1;
c1=sqrt(2/Tb)*cos(2*pi*fc*t);
c2=sqrt(2/Tb)*sin(2*pi*fc*t);
                                          30
              EC8561 – COMMUNICATION SYSTEMS LABORATORY
             GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
%generate message signal
N=8;m=rand(1,N);
t1=0;t2=Tb
for i=1:2:(N-1)
t=[t1:(Tb/100):t2]
if m(i)>0.5
m(i)=1;
m_s=ones(1,length(t));
else
m(i)=0;
m_s=-1*ones(1,length(t));
end
%odd bits modulated signal
odd_sig(i,:)=c1.*m_s;
if m(i+1)>0.5
18
m(i+1)=1;
m_s=ones(1,length(t));
else
m(i+1)=0;
m_s=-1*ones(1,length(t));
end
%even bits modulated
signal
even_sig(i,:)=c2.*m_s;
%qpsk signal
qpsk=odd_sig+even_sig;
%Plot the QPSK modulated signal
subplot(3,2,4);plot(t,qpsk(i,:));
title('QPSK signal');xlabel('t---->');ylabel('s(t)');grid on; hold on;
t1=t1+(Tb+.01); t2=t2+(Tb+.01);
end
hold off
%Plot the binary data bits and carrier signal
subplot(3,2,1);stem(m);
title('binary data bits');xlabel('n---->');ylabel('b(n)');grid on;
subplot(3,2,2);plot(t,c1);
title('carrier signal-1');xlabel('t---->');ylabel('c1(t)');grid on;
subplot(3,2,3);plot(t,c2);
title('carrier signal-2');xlabel('t---->');ylabel('c2(t)');grid on;
% QPSK Demodulation
t1=0;t2=Tb
for i=1:N-1
t=[t1:(Tb/100):t2]
%correlator
x1=sum(c1.*qpsk(i,:));
x2=sum(c2.*qpsk(i,:));
%decision device
if (x1>0&&x2>0)
demod(i)=1;
demod(i+1)=1;
elseif (x1>0&&x2<0)
demod(i)=1;
demod(i+1)=0;
elseif (x1<0&&x2<0)
demod(i)=0;
demod(i+1)=0;
elseif (x1<0&&x2>0)
demod(i)=0;
demod(i+1)=1;
end
                                         31
              EC8561 – COMMUNICATION SYSTEMS LABORATORY
             GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
t1=t1+(Tb+.01); t2=t2+(Tb+.01)end
                                    32
              EC8561 – COMMUNICATION SYSTEMS LABORATORY
             GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
subplot(3,2,5);stem(demod);
title('qpsk demodulated bits');xlabel('n---->');ylabel('b(n)');grid on;
QAM
clc;
clear all;
close all;
t = -0.04:1.e-4:0.04;
t1 = -0.02:1.e-4:0;
t2 = 0:1.e-4:0.02;
Ta = 0.01;
mu1 = 1 - abs((t1+Ta)/Ta);
mu1 = [zeros([1 200]),mu1,zeros([1 400])];
mu2 = 1 - abs((t2-Ta)/Ta);
mu2 = [zeros([1 400]),mu2,zeros([1 200])];
m2 = mu1 - mu2;
m1 = sinc(2*t/Ta) + 2*sinc(2*t/Ta+1) + sinc(2*t/Ta-1);
f = 400;
c1 = cos(2*f*pi*t);
c2 = cos(2*f*pi*t - pi/2);
qam = 2*m1.*c1 + 2*m2.*c2;
dem1 = qam.*c1;
dem2 = qam.*c2;
a = fir1(50,10*1.e-4);
b = 1;
rec1 = filter(a,b,dem1);
rec2 = filter(a,b,dem2);
fl = length(t);
fl = 2^ceil(log2(fl));
f = (-fl/2:fl/2-1)/(fl*1.e-4);
m1F = fftshift(fft(m1,fl));
m2F = fftshift(fft(m2,fl));
qamF = fftshift(fft(qam,fl));
rec1F = fftshift(fft(rec1,fl));
rec2F = fftshift(fft(rec2,fl));
figure(1);
subplot(3,2,1);
plot(t,m1);
title('Message 1');
xlabel('{\it t} (sec)');
ylabel('m-1(t)');
grid;
subplot(3,2,2);
plot(t,m2);
title('Message 2');
xlabel('{\it t} (sec)');
ylabel('m-2(t)');
grid; subplot(3,2,
[3 4]);
plot(t,qam);
title('QAM'); xlabel('{\
it t} (sec)');
ylabel('QAM');
grid;
subplot(3,2,5);
plot(t,rec1); xlabel('{\
it t} (sec)');
ylabel('m-1(t)');
                                         33
              EC8561 – COMMUNICATION SYSTEMS LABORATORY
             GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
title('Recovered Signal 1');
grid;
subplot(3,2,6);
plot(t,rec2); xlabel('{\
it t} (sec)');
ylabel('m-2(t)');
title('Recovered Signal 2');
grid;
figure(2);
subplot(3,2,1);
plot(f,abs(m1F));
title('Freq Responce of Message Signal 1');
xlabel('f(Hz)');
ylabel('M-1(f)');
grid;
axis([-600 600 0 200]);
subplot(3,2,2);
plot(f,abs(m2F));
title('Freq Responce of Message Signal 1');
xlabel('f(Hz)');
ylabel('M-2(f)');
grid;
axis([-600 600 0 200]);
subplot(3,2,[3 4]);
plot(f,abs(qamF));
title('Freq Responce of QAM');
xlabel('f(Hz)');
ylabel('QAM(f)');
grid;
axis([-600 600 0 400]);
subplot(3,2,5);
plot(f,abs(rec1F));
title('Freq Responce of Recoverd Signal');
xlabel('f(Hz)');
ylabel('M-1(f)');
grid;
axis([-600 600 0 200]);
subplot(3,2,6);
plot(f,abs(rec2F));
title('Freq Responce of Recoverd Signal');
xlabel('f(Hz)');
ylabel('M-2(f)');
grid;
axis([-600 600 0 200]);
                                         34
          EC8561 – COMMUNICATION SYSTEMS LABORATORY
         GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
MODEL OUTPUT
DPSK
QPSK
                               35
             EC8561 – COMMUNICATION SYSTEMS LABORATORY
            GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
QAM
 RESULT:
 Thus the simulation of DPSK,QPSK,QAM was performed in MATLAB and corresponding
 waveforms were plotted successfully.
                                          36
                      EC8561 – COMMUNICATION SYSTEMS LABORATORY
                     GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
AIM:
APPARATUS REQUIRED:
          8. Computer
          9. Matlab software Version 2013b
PROCEDURE:
       MATLAB CODING:
  Bpsk conctellation
  clc;
  clear all;
  close all;
  M=2;
  k=log2(M);
  n=3*1e5;
  nsamp=8;
  X=randint(n,1);
  xsym = bi2de(reshape(X,k,length(X)/k).','left-msb');
  Y_psk= modulate(modem.pskmod(M),xsym);
  Ytx_psk = Y_psk;
  EbNo=30;
  SNR=EbNo+10*log10(k)-10*log10(nsamp);
  Ynoisy_psk = awgn(Ytx_psk,SNR,'measured');
  Yrx_psk = Ynoisy_psk;
  h1=scatterplot(Yrx_psk(1:nsamp*5e3),nsamp,0,'r.');
  hold on;
  scatterplot(Yrx_psk(1:5e3),1,0,'k*',h1);
  title('constellation diagram BPSK');
  legend('Received signal' ,'signal constellation'); axis([-5 5 -5 5]);
  hold off;
  QPSK QAM
  clc;
  clear all;
  close all;
  M=16;
  k=log2(M);
                                                       37
              EC8561 – COMMUNICATION SYSTEMS LABORATORY
             GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
n=3*1e5;
nsamp=8;
X=randint(n,1);
xsym = bi2de(reshape(X,k,length(X)/k).','left-msb');
Y_qam= modulate(modem.qammod(M),xsym);
Y_qpsk= modulate(modem.pskmod(M),xsym);
Ytx_qam = Y_qam;
Ytx_qpsk = Y_qpsk;
EbNo=30;
SNR=EbNo+10*log10(k)-10*log10(nsamp);
Ynoisy_qam = awgn(Ytx_qam,SNR,'measured');
Ynoisy_qpsk = awgn(Ytx_qpsk,SNR,'measured');
Yrx_qam = Ynoisy_qam;
Yrx_qpsk = Ynoisy_qpsk;
h1=scatterplot(Yrx_qam(1:nsamp*5e3),nsamp,0,'r.');
hold on;
scatterplot(Yrx_qam(1:5e3),1,0,'k*',h1);
title('constellation diagram 16 QAM');
legend('Received signal' ,'signal constellation');
axis([-5 5 -5 5]);
hold off;
h2=scatterplot(Yrx_qpsk(1:nsamp*5e3),nsamp,0,'r.');
hold on;
scatterplot(Yrx_qpsk(1:5e3),1,0,'k*',h2);
title('constellation diagram 16 PSK');
legend('Received signal' ,'signal constellation');
axis([-5 5 -5 5]);
hold off;
title('constellation diagram 16 PSK');
legend('Received signal' ,'signal constellation');
axis([-5 5 -5 5]);
hold off;
MODEL OUPUT
BPSK
                                         38
              EC8561 – COMMUNICATION SYSTEMS LABORATORY
             GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
QPSK
QAM
RESULT
  Thus the Signal Constellation of BPSK, QPSK And QAM observed using MATLAB and
  corresponding waveforms were plotted successfully.
                                            39
                EC8561 – COMMUNICATION SYSTEMS LABORATORY
               GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
   EX.NO., 11 SIMULATION OF ASK, FSK AND BPSK DETECTION SCHEMES DATE
   AIM:
APPARATUS REQUIRED:
       3. Computer
       4. Matlab software Version 2013b
PROCEDURE:
                                         41
              EC8561 – COMMUNICATION SYSTEMS LABORATORY
             GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
title('binary data');xlabel('n---->'); ylabel('b(n)');grid on;
subplot(3,2,3);plot(t,c1);
title('carrier signal-1');xlabel('t---->');ylabel('c1(t)');grid on;
subplot(3,2,4);plot(t,c2);
title('carrier signal-2');xlabel('t---->');ylabel('c2(t)');grid on;
13
% FSK Demodulation
t1=0;t2=Tb
for i=1:N
t=[t1:(Tb/100):t2]
%correlator
x1=sum(c1.*fsk_sig1(i,:));
x2=sum(c2.*fsk_sig2(i,:));
x=x1-x2;
%decision device
if x>0
demod(i)=1; else
demod(i)=0;
end t1=t1+
(Tb+.01);
t2=t2+(Tb+.01);
end
%Plotting the demodulated data bits
subplot(3,2,6);stem(demod);
title(' demodulated data');xlabel('n---->');ylabel('b(n)'); grid on;
BPSK
clc;
clear all;
close all;
%GENERATE CARRIER SIGNAL
Tb=1;
t=0:Tb/100:Tb;
fc=2;
c=sqrt(2/Tb)*sin(2*pi*fc*t);
%generate message signal
N=8;
m=rand(1,N);
t1=0;t2=Tb
for i=1:N
t=[t1:.01:t2]
if m(i)>0.5
m(i)=1;
m_s=ones(1,length(t));
else
m(i)=0;
m_s=-1*ones(1,length(t));
end
message(i,:)=m_s;
%product of carrier and message signal
bpsk_sig(i,:)=c.*m_s;
%Plot the message and BPSK modulated signal
subplot(5,1,2);axis([0 N -2 2]);plot(t,message(i,:),'r');
title('message signal(POLAR form)');xlabel('t--->');ylabel('m(t)');
grid on; hold on;
                                         42
              EC8561 – COMMUNICATION SYSTEMS LABORATORY
             GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
subplot(5,1,4);plot(t,bpsk_sig(i,:));
title('BPSK signal');xlabel('t--->');ylabel('s(t)');
grid on; hold on;
t1=t1+1.01; t2=t2+1.01;
end
hold off
%plot the input binary data and carrier signal
subplot(5,1,1);stem(m);
title('binary data bits');xlabel('n--->');ylabel('b(n)');
grid on;
subplot(5,1,3);plot(t,c);
title('carrier signal');xlabel('t--->');ylabel('c(t)');
grid on;
7
% PSK Demodulation
t1=0;t2=Tb
for i=1:N
t=[t1:.01:t2]
%correlator
x=sum(c.*bpsk_sig(i,:));
%decision device
if x>0
demod(i)=1;
else
demod(i)=0;
end
t1=t1+1.01;
t2=t2+1.01;
end
%plot the demodulated data bits
subplot(5,1,5);stem(demod);
title('demodulated data');xlabel('n--->');ylabel('b(n)');
grid on
MODEL OUTPUT
ASK
                                         43
               EC8561 – COMMUNICATION SYSTEMS LABORATORY
              GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
FSK
BPSK
RESULT:
  The simulation of ASK FSK and PSK were done using MATLAB and the outputs were
  recorded.
                                            44
                 EC8561 – COMMUNICATION SYSTEMS LABORATORY
                GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
EX.NO.12 LINEAR BLOCK AND CYCLIC ERROR CONTROL CODING
TECHNIQUES                                       DATE:
AIM:
To simulate error linear block code error control coding technique using MATLAB.
APPARATUS REQUIRED:
      10. Computer
      11. Matlab software Version 2013b
THEORY:
          In coding theory, a linear code is an error-correcting code for which any linear
   combination of codewords is also a codeword. Linear codes are traditionally partitioned into
   block codes and convolutional codes, although turbo codes can be seen as a hybrid of these
   two types. Linear codes allow for more efficient encoding and decoding algorithms than other
   codes.Linear codes are used in forward error correction and are applied in methods for
   transmitting symbols (e.g., bits) on a communications channel so that, if errors occur in the
   communication, some errors can be corrected or detected by the recipient of a message block.
   The codewords in a linear block code are blocks of symbols which are encoded using more
   symbols
   than the original value to be sent. A linear code of length n transmits blocks containing n
   symbols. For example, the [7,4,3] Hamming code is a linear binary code which represents 4-bit
   messages using 7-bit codewords. Two distinct codewords differ in at least three bits. As a
   consequence, up to two errors per codeword can be detected while a single error can be
   corrected.
PROCEDURE:
   clc;
   clearall;
   %g=input('Enter The Generator Matrix: ');%row value separate by semicolon
   disp('The Generator Matrix is : ');
   g= [1 1 0 1 0 0 0 ;0 1 1 0 1 0 0;1 1 1 0 0 1 0;1 0 1 0 0 0 1];
   disp(g);
   disp ('The Order of Linear Block Code for given Generator Matrix is:');
   [n,k] = size(transpose(g));
   disp('The Code Word Length is : ');disp(n);
   disp('The Parity Bit Length is : ');disp(k);
                                                 45
                 EC8561 – COMMUNICATION SYSTEMS LABORATORY
                GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
for i = 1:2^k
                                     46
                 EC8561 – COMMUNICATION SYSTEMS LABORATORY
                GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
    for j = k:-1:1
    if rem(i-1,2^(-j+k+1))>=2^(-j+k)
    m(i,j)=1;
    else
    m(i,j)=0;
    end
    end
    end
    disp('The Possible Message Bits are :
    '); disp(' c0 c1 c2 c3');
    disp(m);
    disp('The Possible Codewords are :')
disp('        b0 b1 b2 c0 c1 c2 c3 Hamming weight')
c = rem(m*g,2);
    d_min = sum((c(1:2^k,:))');
    d_min2=d_min';
    s= [ c d_min2];
    disp(s);
    disp('The Minimum Hamming Weight for the given Block Code is= ');
    d_min1 = min(sum((c(2:2^k,:))'));
    disp(d_min1);
    % DECode
     p = [g(:,1:n-k)];
     h = [eye(n-k),transpose(p)];
    disp('The H Matrix is ');
    disp(h);
    ht = transpose(h);
    disp('The H Transpose Matrix is ');
    disp(ht);
     r=[0 0 1 1 1 0 1];
     e=rem(r*ht,2);
    disp('Syndrome of a Given Codeword is :');
    disp(e);
    for i = 1:1:size(ht)
    if(ht(i,1:3)==e)
    r(i) = 1-r(i);
    break;
    end
    end
    disp('The Error is in
    bit:'); disp(i);
    disp('The Corrected Codeword is
    :'); disp(r);
                                                47
                     EC8561 – COMMUNICATION SYSTEMS LABORATORY
                    GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
    OUTPUT:
The Generator Matrix is :
          1 1 0 1 0 0 0
          0 1 1 0 1 0 0
          1 1 1 0 0 1 0
          1 0 1 0 0 0 1
      The Order of Linear Block Code for given Generator Matrix is:
          1 0 1 0
          1 0 1 1
          1 1 0 0
          1 1 0 1
          1 1 1 0
          1 1 1 1
       The Possible Codewordsare :
         b0 b1 b2 c0 c1 c2 c3 Hamming weight
          0 0 0 0 0 0 0            0
          1 0 1 0 0 0 1            3
          1 1 1 0 0 1 0            4
          0 1 0 0 0 1 1            3
          0 1 1 0 1 0 0            3
          1 1 0 0 1 0 1            4
          1 0 0 0 1 1 0            3
          0 0 1 0 1 1 1            4
          1 1 0 1 0 0 0            3
          0 1 1 1 0 0 1            4
       0 0 1 1 0 1 0               3
         1 0 0 1 0 1 1             4
         1 0 1 1 1 0 0             4
         0 0 0 1 1 0 1             3
         0 1 0 1 1 1 0             4
         1 1 1 1 1 1 1             7
                                                     48
                   EC8561 – COMMUNICATION SYSTEMS LABORATORY
                  GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
The Minimum Hamming Weight for the given Block Code is= 3
   The H Matrix is
      1 0 0 1 0 1 1
      0 1 0 1 1 1 0
      0 0 1 0 1 1 1
   The H Transpose Matrix is
      1 0 0
      0 1 0
      0 0 1
      1 1 0
      0 1 1
      1 1 1
      1 0 1
   Syndrome of a Given Codewordis :
     0 0 1
   The Error is in bit:
     3
   The Corrected Codewordis :
0 0 0 1 1 0 1
CYCLIC CODE
%Generation of parity check matrix and generator matrix for a (7, 4) Hamming code.
[h,g,n,k] = hammgen(3);
%Generation of parity check matrix for the generator polynomial g(x) = 1+x+x3
h1 = hammgen(3,[1 0 1 1])
%Computation of code vectors for a cyclic code
clc;
close
all; n=7;
k=4;
msg=[1 0 0 1; 1 0 1 0; 1 0 1 1];
code = encode(msg,n,k,'cyclic');
msg
code
%Syndrome decoding
clc;
close
all; q=3;
n=2^q-1; k=n-q;
parmat = hammgen(q); % produce parity-check matrix
trt = syndtable(parmat); % produce decoding table
recd = [1 0 1 1 1 1 0 ] %received vector
syndrome = rem(recd * parmat',2);
syndrome_de = bi2de(syndrome, 'left-msb'); %convert to decimal
disp(['Syndrome = ',num2str(syndrome_de),.....
' (decimal), ',num2str(syndrome),' (binary) ']);
corrvect = trt(1+syndrome_de, :);%correction vector
correctedcode= rem(corrvect+recd,2);
parmat
corrvect
correctedcode
                                                  49
              EC8561 – COMMUNICATION SYSTEMS LABORATORY
             GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
RESULT:
Thus the program for error control coding is done using MATLAB and the output is verified.
                                               50
              EC8561 – COMMUNICATION SYSTEMS LABORATORY
             GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
AIM:
APPARATUS REQUIRED:
  1. Computer
  2. Matlab software Version 2013b
PROCEDURE:
THEORY
Convolutional Code:
        Convolutional codes are commonly described using two parameters: the code rate and
  the constraint length. The code rate, k/n, is expressed as a ratio of the number of bits into the
  convolutional encoder (k) to the number of channel symbols output by the convolutional
  encoder (n) in a given encoder cycle. The constraint length parameter, K, denotes the "length"
  of the convolutional encoder, i.e. how many k-bit stages are available to feed the
  combinatorial logic that produces the output symbols. Closely related to K is the parameter
  m, which indicates how many encoder cycles an input bit is retained and used for encoding
  after it first appears at the input to the convolutional encoder. The m parameter can be
  thought of as the memory length of the encoder. Convolutional codes are widely used as
  channel codes in practical communication systems for error correction. The encoded bits
  depend on the current k input bits and a few past input bits. The main decoding strategy for
  convolutional codes is based on the widely used Viterbi algorithm. As a result of the wide
  acceptance of convolutional codes, there have been several approaches to modify and extend
  this basic coding scheme. Trellis coded modulation (TCM) and turbo codes are two such
  examples. The operation of a convolutional encoder can be explained in several but
  equivalent ways such as, by a) state diagram representation, b) tree diagram representation
  and c) trellis diagram representation
  MATLAB CODING
   clc; clear
   all; close
   all;
   m=[1 0 1 1];%messagesequence
   p=2%%no of flipflop
   z=zeros(1,p);
   mm=horzcat(m,z);%additional zeros add
   d1=0;d2=0; %inital content x=[];
                                                51
        EC8561 – COMMUNICATION SYSTEMS LABORATORY
       GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
%initialcontent flipflop states
                                  52
                 EC8561 – COMMUNICATION SYSTEMS LABORATORY
                GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
         c=[];%codevector
         for i=1:1:length(mm)
             d1(i+1)=mm(i);
             d2(i+1)=d1(i);
             x=[x; d1(i) d2(i)];
             u(i)=xor(x(i,1),x(i,2));
             c1(i)=xor(u(i),mm(i));%1st output bit
             c2(i)=xor(mm(i),x(i,2));%2nd output bit
             c=[c c1(i) c2(i)];
         end
         disp('state of the shift register:')
         x
         disp('code vector')
         c
OUTPUT
RESULT:
                                               53
              EC8561 – COMMUNICATION SYSTEMS LABORATORY
             GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
 EX.NO. 14     COMMUNICATION LINK SIMULATION                                    DATE:
AIM:
  APPARATUS REQUIRED:
          PC with MATLAB Software with Simulink tool
  PROCEDURE:
                1.   Start simulink section
                2.   Select fileNew Model in the simulink library to construct a new model
                3.   Go to simulink library select appropriate module and add to model
                4.   Connect all the inserted models
                5.   Set the simulation parameters
                6.   Run the simulation and observe and save all the plots and values.
AM MODULATION
                                                54
            EC8561 – COMMUNICATION SYSTEMS LABORATORY
           GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
MODEL OUTPUT
                                      55
               EC8561 – COMMUNICATION SYSTEMS LABORATORY
              GRACE COLLEGE OF ENGINEERING, THOOTHUKUDI
MODEL GRAPH
  RESULT:
  Thus the Simulink block diagram for communication link is done using MATLAB and the output is
  verified.
56