84
GOVERNMENT COLLEGE OF ENGINEERING Sethurappatti Village, Fathima Nagar Post, Srirangam Taluk, Tiruchirappalli 12. (Affiliated by Anna University, Chennai) Department of electronics and communication engineering M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION SYSTEM LABORATORY - I Prepared by Mr. V. KOUSHICK M.E., P.G.D.VLSI., ASSISTANT PROFESSOR (T) / ECE www.Vidyarthiplus.com www.Vidyarthiplus.com

M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

  • Upload
    others

  • View
    10

  • Download
    0

Embed Size (px)

Citation preview

Page 1: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

GOVERNMENT COLLEGE OF ENGINEERING

Sethurappatti Village, Fathima Nagar Post, Srirangam Taluk, Tiruchirappalli – 12.

(Affiliated by Anna University, Chennai)

Department of electronics and communication

engineering

M.E., COMMUNICATION SYSTEMS

CU 9216 - COMMUNICATION SYSTEM LABORATORY - I

Prepared by

Mr. V. KOUSHICK M.E., P.G.D.VLSI.,

ASSISTANT PROFESSOR (T) / ECE

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 2: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

CONTENTS

SL.NO DATE LIST OF EXPERIMENTS PAGE

NO REMARKS

CHANNEL EQUALIZER DESIGN

1 USING LMS ALGORITHM

2 USING RLS ALGORITHM

TRANSFORM BASED COMPRESSION TECHNIQUES

3 USING DCT

4 USING DWT

5 COMPARISON OF CONTINUOUS AND

DISCRETE TRANSFORM

RADIATION PATTERN OF ANTENNA MEASUREMENTS

6 HORN ANTENNA

7 DIPOLE ANTENNA

8 YAGI UDA ANTENNA

9 LOOP ANTENNA

DIGITAL MODULATION SCHEMES

10 QPSK MODULATION USING KIT

11 QPSK MODULATION USING MATLAB

12 PSK MODULATION USING MATLAB

13 QAM MODULATION USING MATLAB

DIGITAL DATA TRANSMISSION

14 PC TO PC COMMUNICATION

15 USING MATLAB

16 USING FIBER OPTIC LINK

LINEAR CODING TECHNIQUES

17 CYCLIC CODES

18 BLOCK CODES

19 OFDM TRANSCEIVER DESIGN USING MATLAB

20 WAVELENGTH AND FREQUENCY

MEASUREMENTS

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 3: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Ex. No.:

CHANNEL EQUALIZER DESIGN USING LMS

ALGORITHM Date:

Aim:

To write a MATLAB program to demonstrate channel equalizer using LMS

algorithm.

Apparatus Required:

1. MATLAB 7 software.

2. Computer.

Theory:

A linear equalizer is a linear filter that is designed to reduce the noise and ISI according

to some criterion of optimality. An Equalizer is a compensator for Channel Distortion.

For communication channels in which the channel characteristics are unknown or time-

varying, optimum transmit and receive filters cannot be designed directly. For such

channels, an equalizer is needed to compensate for the ISI created by the distortion in the

channel. There are three types of equalization methods commonly used:

• Maximum Likelihood (ML) Sequence Detection - Optimal, but Impractical.

• Linear Equalization - Suboptimal, but simple.

• Non-Linear Equalization (DFE) - for severe ISI channels.

Linear Equalizers are simple to implement and are highly effective in channels where is

the ISI is not severe (like the wire line telephone channel). Most linear equalizers are

implemented as a linear transversal filter.

Adaptive equalizer is an essential component of communication systems. Traditionally,

ISI problem is resolved by channel equalization in which the aim is to construct an

equalizer such that the impulse response of the channel/equalizer combination is as close

to z-d as possible, where d is a delay. Frequently the channel parameters are not known in

advance and moreover they may vary with time, in some applications significantly.

Hence, it is necessary to use the adaptive equalizers, which provide the means of tracking

the channel characteristics.

The Normalized LMS Linear Equalizer block uses a linear equalizer and the

normalized LMS algorithm to equalize a linearly modulated baseband signal through a

dispersive channel. During the simulation, the block uses the normalized LMS algorithm

to update the weights, once per symbol. When you set the Number of samples per symbol

parameter to 1, the block implements a symbol-spaced (i.e. T-spaced) equalizer and

update the filter weights once for each symbol. When you set the Number of samples per

symbol parameter to a value greater than 1, the weights are updated once every Nth

sample, for a T/N-spaced equalizer.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 4: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Algorithm:

1. Reset randomizers.

2. Represent channel order.

3. Represent iteration step size.

4. Assume input as Gaussian.

5. Plot iteration Vs error

Program:

%LMS channel adaptation

%reset randomizers

randn('state',sum(100*clock));

rand('state',sum(100*clock));

numpoints=5000;

numtaps=10; %channel order

mu=0.01; %iteration step size

%input is gaussian

x=randn(numpoints,1)+i*randn(numpoints,1);

h=rand(numtaps,1);

h=h/max(h);

d=filter(h,1,x);

w=[];

y=[];

in=[];

e=[];

w=zeros(numtaps+1,1)+i*zeros(numtaps+1,1);

for n=numtaps+1:numpoints

in = x(n:-1:n-numtaps);

y(n)=w'*in;

e(n)=d(n)-y(n);

w=w+mu*(real(e(n)*conj(in))-i*imag(e(n)*conj(in)));

end

figure(10);

semilogy(abs(e));

title(['LMS Adaptation Learning Curve using mu=',num2str(mu)]);

xlabel('Iteration Number');

ylabel('Output Estimation Error in db');

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 5: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Observation:

Result:

Thus the simulation for channel adaptation using LMS algorithm is done using

MATLAB SOFTWARE.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 6: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Ex. No.:

CHANNEL EQUALIZER DESIGN USING RLS

ALGORITHM Date:

Aim:

To write a MATLAB program to demonstrate channel equalizer using LMS

algorithm.

Apparatus Required:

1. MATLAB 7 software.

2. Computer.

Theory:

The Recursive least squares (RLS) adaptive filter is an algorithm which

recursively finds the filter coefficients that minimize a weighted linear least squares cost

function relating to the input signals. This is in contrast to other algorithms such as the

least mean squares (LMS) that aim to reduce the mean square error. In the derivation of

the RLS, the input signals are considered deterministic, while for the LMS and similar

algorithm they are considered stochastic. Compared to most of its competitors, the RLS

exhibits extremely fast convergence.

In general, the RLS can be used to solve any problem that can be solved

by adaptive filters. For example, suppose that a signal d (n) is transmitted over an

echoey, noisy channel that causes it to be received as

Where represents additive noise. We will attempt to recover the desired

signal by use of a -tap FIR filter, :

Where is the vector

containing the most recent samples of . Our goal is to estimate the

parameters of the filter , and at each time n we refer to the new least squares

estimate by . As time evolves, we would like to avoid completely redoing the

least squares algorithm to find the new estimate for , in terms of .

The benefit of the RLS algorithm is that there is no need to invert matrices,

thereby saving computational power. Another advantage is that it provides

intuition behind such results as the Kalman filter.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 7: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Program:

clc; close all; clear all;

hold off;

N = 2000;

inp= randn(N,1);

n= randn(N,1);

[b,a]= butter(2, 0.25);

Gz= tf(b,a,-1);

sysorder = 10;

imp = [1;zeros(49,1)];

h= filter(b,a,imp);

h= h(1: sysorder);

y= lsim(Gz,inp);

n= n* std (y) | (10*std (n));

d = y+n;

totallength = size(d,1);

N = 80;

lamda = 0.9995;

delta = 1e10;

p = delta*eye(sysorder);

w = zeros(sysorder, 1);

for n = sysorder : N

u= inp(n:-1:n-sysorder+1);

phi = u'*p;

k = phi' | (lamda+phi*u);

y(n) = w'*u;

e(n) = d(n)-y(n);

w = w+k*e(n);

p = (p-k*phi) | lamda;

recordedw(1:sysorder,n) = w;

end

for n = N+1:totallength

u = inp(n:-1:n-sysorder+1);

y(n) = w'*u;

e(n) = d(n) - y(n);

end

plot (d);

hold on;

plot (y,'v-');

title ('system output'); xlabel ('samples'); ylabel ('True and estimated output');

figure;

semilogy (abs(e));

title ('Error Curve'); xlabel ('samples'); ylabel ('error value');

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 8: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Observations:

Result:

Thus the simulation for channel adaptation using RLS algorithm is done using

MATLAB SOFTWARE.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 9: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Ex. No.:

TRANSFORM BASED COMPRESSION TECHNIQUE USING

DISCRETE COSINE TRANSFORM

Date:

Aim:

To perform compression of still image using discrete cosine transform (DCT).

Apparatus Required:

1. MATLAB 7 software.

2. Computer

Theory: Image compression is very important for efficient transmission and storage of

images. Number of bits required to represent the information in an image can be minimized

by removing the redundancy present in it. There are three types of redundancies:

(i) Spatial redundancy, which is due to the correlation or dependence between

neighboring pixel values;

(ii) Spectral redundancy, which is due to the correlation between different color planes or

spectral bands;

(iii) Temporal redundancy, which is present because of correlation between different

frames in images.

Image compression research aims to reduce the number of bits required to represent an image

by removing the spatial and spectral redundancies as much as possible. The most notable

difference between the coding framework introduced here and that of the earlier work is,

instead of randomly selecting a set of noiseless coefficients for use by the decoder for

reconstruction of the input image, the decoder utilizes a subset of noiseless coefficients

that is highly likely to be the most significant.

DCT is performed on the original image, and DCT coefficients are selected. The largest

K1 DCT coefficients are identified based on a sorted list over all of the blocks in the

image; thus, the number of coefficients contributed by each individual 8 x 8 block varies.

Compression ratio is defined as the ratio of an original image and compressed image.

Compression Ratio = Original Image Size / Compressed Image Size

Mean sq err=1/n*n summation (square [M1 (i,j)-M2(i,j)])

Where i stand for row and j stands for column.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 10: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Algorithm:

1. Read the original image.

2. Define the height and width of the image array.

3. Resize the image.

4. Apply DCT transform to the image array

5. Display the DCT coefficients of the image array.

6. Add offset of 200 to eliminate negative pixels value.

7. Display the DCT coefficients of the image array after quantization.

8. Generate the zig – zag sequence coding.

9. Run length encoding.

10. Pre allocate array using memory efficiently.

11. Decompress using DCT.

12. Display image reconstructed.

Formulae:

Compression Ratio = Original Image Size / Compressed Image Size

Mean square error =1/n*n ∑ [M1 (i,j)-M2(i,j)]² Where i stand for row and j stands for column.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 11: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Program:

%Transform based image compression

img=imread('D:\M.E., Lab Record\Comm. Sys Lab I\cameraman.jpg');

figure;

imshow(img,[]);

title('original image');

%j=rgb2gray(img);

%imshow(j,[]);

%title('gray image');

I=imresize(img,[256,256]);

figure;

imshow(I,[]);

title('image after resize');

% Define the heigth and width of the Image array

[height, width]=size(I) %height = 256 width = 768

%apply the dct transform to every 8*8 blocks of the image array

for a=1:8:height

for b=1:8:width

I_DCT(a:a+7,b:b+7)=dct2(I(a:a+7,b:b+7)); % dct conversion

end

end

for a=1:8:height

for b=1:8:width

I_DCT(a:a+7,b:b+7)=I(a:a+7,b:b+7);

end

end

% Display the DCT coefficients of the Image array

figure;

imshow(I_DCT,[]);

title('DCT coefficients after 8*8 DCT transform');

% add offset of 100 for the elimination of the negative pixel values

img_os= I_DCT+200;

figure;

imshow(img_os,[]);

title('image after offset');

%Generating 8*8 quantization array using the standard formula

% 1+((i+j)* quality). Setting quality=2 for instant here

for i=1:8

for j=1:8

qtz_mtrx(i,j)=1+((i+j)* 2);

end

end

% replicating 8*8 Quantization matrix into a 256*256 Quantization matrix to

% generate matrix qtz_mtrx256

qtz_mtrx256=repmat(qtz_mtrx,32,32)

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 12: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

% Quantizing the 256*256 Matrix img_qtz using the qtz_mtrx256 of same size

for c=1:256

for d=1:256

img_qtz(c,d)=round(img_os(c,d)/qtz_mtrx256(c,d));

end

end

% i got number of matrices in command window after quantization

% Display the DCT coefficients of the Image array after quantization

figure;

imshow(img_qtz,[]);

title('DCT coefficents after the quantization');

% dividing 256*256 matrix img_qtz to 8*8 matrix img_qtz8 for generating the

% zigzag sequence for each individual 8*8 blocks

img_qtz8=mat2cell(img_qtz,[8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8

],[8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8]);

% allocating 8*8 Block matrices with the adjacent Cell of the cell array img_qtz8

block_all=zeros(32,32,8,8);

for J=1:32

for K=1:32

for j=1:8

for k=1:8

block_all(J,K,j,k)=img_qtz8J,K(j,k);

end

end

end

end

for J=1:32

for K=1:32

for j=1:8

for k=1:8

block(K+(32*(J-1)))(j,k)=block_all(J,K,j,k);

end

end

end

end %i got ans =44 in Matlab window

%Generating the Zigzag sequence for a single 8*8 Matrix named block;

for i=1:1024;

block_zigi

=[(blocki(1,1)),(blocki(1,2)),(blocki(2,1)),(blocki(3,1)),(blocki(2,2)),(blocki

(1,3)),(blocki(1,4)),(blocki(2,3)),(blocki(3,2)),(blocki(4,1)),(blocki(5,1)),(bl

ocki(4,2)),(blocki(3,3)),(blocki(2,4)),(blocki(1,5)),(blocki(1,6)),(blocki(2,5

)),(blocki(3,4)),(blocki(4,3)),(blocki(5,2)),(blocki(6,1)),(blocki(7,1)),(blocki

(6,2)),(blocki(5,3)),(blocki(4,4)),(blocki(3,5)),(blocki(2,6)),(blocki(1,7)),(bl

ocki(1,8)),(blocki(2,7)),(blocki(3,6)),(blocki(4,5)),(blocki(5,4)),(blocki(6,3

)),(blocki(7,2)),(blocki(8,1)),(blocki(8,2)),(blocki(7,3)),(blocki(6,4)),(blocki

(5,5)),(blocki(4,6)),(blocki(3,7)),(blocki(2,8)),(blocki(3,8)),(blocki(4,7)),(bl

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 13: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

ocki(5,6)),(blocki(6,5)),(blocki(7,4)),(blocki(8,3)),(blocki(8,4)),(blocki(7,5

)),(blocki(6,6)),(blocki(5,7)),(blocki(4,8)),(blocki(5,8)),(blocki(6,7)),(blocki

(7,6)),(blocki(8,5)),(blocki(8,6)),(blocki(7,7)),(blocki(6,8)),(blocki(7,8)),(bl

ocki(8,7)),(blocki(8,8))];

end

% RLE (Run Length Encoding) Block

for j=1:1024;

RLE_in=block_zigj;

for i=1:63;

a=RLE_in(i);

disp(a);

b=RLE_in(i+1);

if(a~=b)

k=k+1;

end

end

rle=ones(1,k); % Reallocate array +using memory efficiently

end

rle(1)=a(1);

m=2;

for i=1:63

a=RLE_in(i);

b=RLE_in(i+1);

if a==b

rle(m)= rle(m)+1;

else m=m+1;

end

end

RLE_OUTj = rle; % the code is self explanatory

% i got more numbers in Matlab window

% decompression using IDCT

for a=1:8:height

for b=1:8:width

I_IDCT(a:a+7,b:b+7)=idct2(I_DCT(a:a+7,b:b+7));

end

end

figure;

imshow(I_IDCT,[]); % display image reconstructed

title('reconstructed image after IDCT');

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 14: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Observation:

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 15: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Calculations:

Result:

Thus the simulation for image compression using DCT is done using MATLAB

SOFTWARE.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 16: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Ex. No.:

TRANSFORM BASED COMPRESSION TECHNIQUE USING

DISCRETE WAVELET TRANSFORM Date:

Aim:

To perform image compression using discrete wavelet transform in MATLAB

Apparatus required:

1. Personal computer

2. MATLAB software

Theory:

Wavelet theory is applicable to several subjects. All wavelet transforms may be

considered forms of time-frequency representation for continuous-time (analog) signals

and so are related to harmonic analysis. Almost all practically useful discrete wavelet

transforms use discrete-time filter banks. These filter banks are called the wavelet and

scaling coefficients in wavelets nomenclature. These filter banks may contain either finite

impulse response (FIR) or infinite impulse response (IIR) filters. The wavelets forming a

continuous wavelet transform (CWT) are subject to the uncertainty principle of Fourier

analysis respective sampling theory: Given a signal with some event in it, one cannot

assign simultaneously an exact time and frequency response scale to that event.

The product of the uncertainties of time and frequency response scale has a lower

bound. Thus, in the scaleogram of a continuous wavelet transform of this signal, such an

event marks an entire region in the time-scale plane, instead of just one point. Also,

discrete wavelet bases may be considered in the context of other forms of the uncertainty

principle. Wavelet transforms are broadly divided into three classes: continuous, discrete

and multi resolution-based.

Algorithm:

1. Read the image

2. Apply DWT to every 8*8 block of the image.

3. Display the original and transformed image.

4. Initialize parameters to reconstruct the image.

5. Reconstruct the transformed image.

6. Display the reconstructed image.

7. Find the difference between the original and reconstructed image.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 17: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Program:

clc;

clear all;

close all;

i = imread('D:\M.E., Lab Record\Comm. Sys Lab I\cameraman.jpg');

i = im2double(i);

[a,h,v,d]=dwt2(i,'db1');

result = [a,h,v,d];

subplot(2,2,1);

imshow(i);

title('Original Image');

subplot(2,2,2);

imshow(result,[]);

title('DWT coefficient after 8*8 transform');

h=zeros(size(h));

v=zeros(size(v));

d=zeros(size(d));

i_reconstruct=idwt2(a,h,v,d,'db1');

subplot(2,2,3);

imshow(i_reconstruct,[]);

title('Reconstructed Image');

diff=i-i_reconstruct;

subplot(2,2,4);

imshow(diff,[]);

title('Difference between Original and Reconstructed Image');

Calculations:

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 18: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Observation:

Result:

Thus the simulation for discrete wavelet transform is done using MATLAB

SOFTWARE.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 19: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Ex. No.:

COMPARISON OF CONTINUOUS AND DISCRETE

TRANSFORM Date:

Aim:

To compare the performance evaluation of continuous and discrete transforms

using MATLAB.

Apparatus required:

1. Personal computer

2. MATLAB software

Theory:

Wavelet theory is applicable to several subjects. All wavelet transforms may be

considered forms of time-frequency representation for continuous-time (analog) signals

and so are related to harmonic analysis. Almost all practically useful discrete wavelet

transforms use discrete-time filter banks. These filter banks are called the wavelet and

scaling coefficients in wavelets nomenclature. These filter banks may contain either finite

impulse response (FIR) or infinite impulse response (IIR) filters. The wavelets forming a

continuous wavelet transform (CWT) are subject to the uncertainty principle of Fourier

analysis respective sampling theory: Given a signal with some event in it, one cannot

assign simultaneously an exact time and frequency response scale to that event. Thus, in

the scaleogram of a continuous wavelet transform of this signal, such an event marks an

entire region in the time-scale plane, instead of just one point. Also, discrete wavelet

bases may be considered in the context of other forms of the uncertainty principle.

Wavelet transforms are broadly divided into three classes: continuous, discrete and multi

resolution-based.

Algorithm:

1. Initially we have to load the signal for detecting self similarity using the

„vonkoch‟ function.

2. Analyze the signal using wavelength decomposition filters.

3. Compute and reshape DWT to compare with CWT.

4. Compute the continuous wavelet coefficients of the vector S at real, positive

SCALES, using the wavelet whose name is 'wname' .

5. Returns the m-by-n matrix whose elements are taken column-wise using the

„reshape‟ function.

6. Returns A withrows flipped in the up-down direction, that is, about a

horizontal axis using the „flipud‟ function.

7. Plot the Discrete transform absolute coefficients.

8. Compute CWT and compare with DWT

9. Plot the Continuous transform absolute coefficients.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 20: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Program:

load vonkoch

vonkoch=vonkoch(1:510);

len=length(vonkoch);

[c,l]=wavedec(vonkoch,5,'sym2');

cfd=zeros(5,len);

for k=1:5

d=detcoef(c,l,k);

d=d(ones(1,2^k),:);

cfd(k,:)=wkeep(d(:)',len);

end

cfd=cfd(:);

I=find(abs(cfd) <sqrt(eps));

cfd(I)=zeros(size(I));

cfd=reshape(cfd,5,len);

subplot(311);

plot(vonkoch);

title('Analyzed signal.');

set(gca,'xlim',[0 510]);

subplot(312);

image(flipud(wcodemat(cfd,255,'row')));

colormap(pink(255));

set(gca,'yticklabel',[]);

title('Discrete Transform,absolute coefficients');

ylabel('Level');

subplot(313);

ccfs=cwt(vonkoch,1:32,'sym2','plot');

title('Continuous Transform, absolute coefficients');

set(gca,'yticklabel',[]);

ylabel('Scale');

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 21: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Observation:

Result:

Thus the simulation for discrete and continuous transform is done using

MATLAB SOFTWARE.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 22: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Ex. No.:

RADIATION PATTERN MEASUREMENT OF HORN

ANTENNA Date:

Aim:

To find the radiation pattern of the horn antenna.

Apparatus Required:

1. Klystron power supply.

2. Reflex klystron oscillator.

3. Three port circulator with M.T

4. Frequency meter.

5. Variable attenuator.

6. Waveguide detector mounts.

7. Horn antenna.

8. Slotted line section.

9. CR0.

10. Waveguide stand

Theory:

The transmitted power (Pt) of an antenna of gain (G) and the receiving

power (Pr) of an antenna of gain (G) are related by the equation.

Pr/Pt= (λ0 /4πs) ² G1G2

S - Distance separation between two antennas, Xo - free space wavelength.

If two similar antennas are being used then G1=G2=G then the equation

reduces to

Pr/Pt = (λ/ 4πs) ² G2

λo is calculated using formula.

(1/ λg) ²= (1/λ0)-(1/2a) ²

λg is the successive minima‟s separation distance “Smin”.

The minimum distance of Separation between two antennas is given by

Smin= 2d²/ λo, where d= 9.6 cm the large dimension of transmitting

antenna.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 23: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Procedure:

1. Before connecting the two antennas, connect the waveguide detector mount

directly to the slotted line.

2. Switch “ON” the power supply and obtain oscillations.

3. Adjust the variable attenuator and tune the waveguide detector mount to get

maximum voltage.

4. Note down the frequency of oscillation using the frequency meter.

5. Find the distance of separation between successive minima in the slotted line

to calculated λg and λo.

6. Connect the two horn antenna H 1& H 2 between the slotted line & waveguide

detector.

7. Keep the distance between two horns greater then Smin So that antenna under

test is in the far field of transmitting antenna & note down the distance of

separation „S‟ between two horns.

8. Note down the corresponding voltage reading VR in the CR0 connected to the

Waveguide detector mount without any tuning.

9. Repeat the experiment for different values of separation between two horns.

10. Calculated the gain using the formula gain in dB = l0log10 (VR/VT*4πS/λo)

Block Diagram:

Formulae:

Gain in dB = 10log(Vout/Vin)

KLYSTRON

POWER

SUPPLY

KLYSTRON

WITH

MOUNT

FREQUENCY

METER

VARIABLE

ATTENUATOR

CRO

WAVE

GUIDE

DETECTOR

MOUNT

SLOTTED

LINE

HORN ANTENNA

RXER HORN ANTENNA

TXER

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 24: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Tabulation:

Half power beam width of Horn antenna: Input voltage:

E – Plane Horn H – Plane Horn

Angle in

degree

Amplitude in volts Gain in

dB

Angle in

degree

Amplitude in

volts

Gain in

dB

Precautions:

1. Before switch ON the power supply, ensure that all the knob are kept in minimum

position.

2. Switch ON the power supply, set the beam voltage between 230V to 270V.

3. Set the beam current in the range of 17mAmps to 20 mAmps. Always the repller

voltage having negative value it should be in the range of 150V to 200V.

Calculations:

Result:

Thus the radiation pattern of Horn antenna was calculated.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 25: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Ex. No.:

RADIATION PATTERN OF DIPOLE ANTENNA Date:

Aim:

To measure the radiation pattern of a dipole antenna.

Apparatus Required:

1. Antenna trainer kit

2. Detector assembly (receiver)

3. Array antenna (transmitter)

Theory:

This fundamental radio antenna is a metallic rod or tubing or wire which has a

physical length approximately λ/2 in free space at frequency of operation. It is known as

half wavelength dipole or half wave dipole or half wave doublet. It is also known as

Hertz antenna.

Two metallic rods are used for the antenna are mounted horizontally on an

insulator & a supporting structure. The gap between the two rod is one quarter of

wavelength of the signal to be received the total length of two rods is the necessary half

which are mounted horizontally on an insulator & supporting structure.

This may be defined as a symmetric antenna in which two ends are at equal

potentials with respect to the center point. This is the unit from which many more

complex antennas can be constructed. The gap in the centre of λ/2 antenna is not counted.

Procedure:

1. Connections are given as per the circuit diagram.

2. Mount an antenna on stand horizontally.

3. Switch on VHF meter so that transmitter transmits the radiation.

4. Switch on field strength meter to measure the field strength of received waves.

Settings:

1. Set 100µA in the antenna trainer kit.

2. In RF detector kit, set the maximum level of gain.

3. Connect Antenna trainer kit with the transmitting antenna (Half wave Dipole) and

connect receiving antenna (Folded Dipole) with RF detector kit.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 26: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Block diagram:

Formulae:

Ae = πr²

Gain in dB = ln (Approximate Value (or) Absolute Value / Maximum Value)

D = 4πAe / λ²

Antenna Gain = Maximum power radiated from test antenna / Max. power

radiated from Reference antenna

Power = I²Rr (I = 100µAmps)

Radiation Resistance of the Half wave dipole antenna (Rr = 73Ω)

Radiation Resistance of the Folded dipole antenna (Rr = 292Ω)

Calculations:

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 27: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Radiation pattern of Dipole antenna:

Input Current: Half power beam width:

Result:

Thus the radiation pattern of the dipole antenna was measured.

S.No Angle in degrees Amplitude in Volts Gain in dB

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 28: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Ex. No.:

RADIATION PATTERN OF YAGI-UDA ANTENNA

Date:

Aim:

To find the radiation pattern of yagi-uda antenna consisting of folded dipole with

reflector & director.

Apparatus Required:

1. Half wave dipole.

2. Yagi antenna.

3. Antenna trainer kit.

4. Detector assembly.

Theory:

Yagi-uda or simply Yagi antennas are the most high gain antennas. It consists of a

driven element, a reflector & one or more directors (i.e.) Yagi Uda antenna is an array of

a driven element & one or more parasitic element.

The driven element is a resonant half wave dipole usually of metallic rod. The

parasitic antenna element of continuous metallic rod & are arranged parallel to the driven

element. They are arranged collinearly & close together. The parasitic element in front of

driven element is known as director & where as element in back of it known as reflector.

The reflector is 5% more & director is 5% less than drive element which is λ/2 at

resonant frequency.

Procedure:

1. Arrange the setup as given in block diagram.

2. Mount 5 element folded dipole on the transmitting mask.

3. Bring the detector assembly there to main unit & adjust the height of both

transmitting & receiving antenna to the same height.

4. Keep detector assembly from main unit at a distance of 0.5 & align both.

5. Keep the RF level & full scale to adjust to minimum & directional coupler switch

to forward.

6. Increase RF level gradually & see that the deflection meter is approximately

40.50 mA.

7. Align in such a way that the arrow mark coincide with the zero marking of meter

scale.

8. Take reading at an interval of 10⁰ & note the deflection.

9. Convert the meter reading into decibel value.

10. Plot the graph in the degree of rotation of antenna against detector level(dB)

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 29: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Block diagram:

Settings:

1. Set 100µA in the antenna trainer kit.

2. In RF detector kit, set the maximum level of gain.

3. Connect Antenna trainer kit with the transmitting antenna (Yagi-Uda) and connect

receiving antenna (Folded dipole) with RF detector kit.

Formulae:

Front to Back ratio (FBR) = Power radiated in desired direction (P1) / Power

radiated in opposite direction (P2)

FBR in dB = 10 log(P1/P2)

Power = I²Rr ( I = 100µAmps)

Ae = πr²

Gain in dB = ln (Approximate Value (or) Absolute Value / Maximum Value)

D = 4πAe / λ²

Antenna Gain = Maximum power radiated from test antenna / Max. power

radiated from Reference antenna

Calculations:

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 30: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Radiation pattern of Yagi - Uda antenna:

Input Current: Half power beam width:

Result:

Thus the radiation pattern of Yagi-uda antenna was calculated.

S.No Angle in degrees Amplitude in Volts Gain in dB

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 31: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Ex. No.:

RADIATION PATTERN OF LOOP ANTENNA

Date:

Aim:

To study and plot the characteristics of Loop antenna.

Apparatus required:

1. Synthesized RF transmitter (VRFT-06VT)

2. Synthesized RF receiver (VRFT-06VR)

3. Antenna mounting set up

4. Loop antenna (Receiver side)

5. Dipole Antenna (Transmitter side)

6. Antenna intelligent controller

7. N-N cable (2 Nos)

8. BNC-BNC cable (2 Nos)

Theory:

By definition, the small transmitting loop is one which has a circumference less

than one quarter of a wave length. Because of its small size, it is possibly an attractive

proposition for someone with inadequate space to extract to a larger aerial. It is normally

used for direction finding. So it is also called as direction finder. Its efficiency is very

high while using as a receiver.

Procedure:

1. Make the connections as in the diagram.

2. Switch on the antenna intelligent controller and Synthesized RF transmitter

and receiver.

3. Set the RF frequency of (VRFT-06VT) and (VRFT-06VR) to 850 MHz

4. Connect the Loop antenna to the receiver side.

5. Connect the dipole antenna to the transmitter side to get good radiation pattern

of Loop antenna.

6. Press the switch on the stepper motor set up.

7. Select auto / manual mode in antenna intelligent controller.

8. Note down the various angles and corresponding gain in dB.

9. Plot the antenna radiation pattern using polar chart.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 32: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Block diagram:

Settings:

1. Set 100µA in the antenna trainer kit.

2. In RF detector kit, set the maximum level of gain.

3. Connect Antenna trainer kit with the transmitting antenna (Loop Antenna) and

receiving antenna with RF detector kit.

Formulae:

Radiation Resistance of the loop antenna (Single Turn) = 0.788Ω

Ae = πr²

Gain in dB = ln (Approximate Value (or) Absolute Value / Maximum Value)

D = 4πAe / λ²

Antenna Gain = Maximum power radiated from test antenna / Max. power

radiated from Reference antenna

Power = I²Rr (I = 100µAmps)

Radiation Resistance of the Folded dipole antenna = 292Ω

Calculations:

Antenna

Trainer Kit

Transmitting

Antenna

Receiving

Antenna

RF Detector

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 33: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Radiation pattern of Loop antenna:

Input Voltage: Half power beam width:

S.No Angle in degrees Amplitude in Volts Gain in dB

Result:

Thus the radiation pattern of Loop antenna was measured.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 34: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Ex. No.:

PERFORMANCE EVALUATION OF QPSK MODULATION Date:

Aim:

To analyze the performance of QPSK Modulation.

Apparatus Required:

1. Experimental Kits ADCL-02 & ADCL-03

2. Connecting Chords and Power Supply

3. 3. 20 MHZ Dual Trace Oscilloscope

Theory:

The system performance of a digital communication network can be enhanced by

incorporating a coding technique, within the system, known as Gray coding. The gray

encoder is used to map the data in such a way as to help reduce bit errors. A QPSK

system takes the input data bits, two at a time, and creates a symbol that represents one of

four phase states. The gray encoder therefore is used to map every two input data bits to

one of four unique symbol values so that the bit pairs that are used to generate the

symbols are only one bit different from each adjacent symbol. This technique proves to

help with error performance because if a symbol is received in error, it will contain only

one error bit if it was received in error to an adjacent symbol.

Procedure:

1. Refer to the block diagram and carry out the following connections and switch

settings

2. Connect power supply in proper polarity to the kits ADCL-02 and ADCL-03 and

switch it ON

3. Select data pattern of simulated data using switch SW1

4. Connect SDATA generated to DATAIN of the NRZ-L coder

5. Connect NRZ-L DATA to DATAIN of the DIBIT CONVERSION

6. Connect the dibit DATA I &Q bit to the control input C1 & C2 of CARRIER

MODULATOR respectively.

7. Connect carrier component to input of CARRIER MODULATOR as follows

a.SIN 1 to IN 1

b.SIN 2 to IN 2

c.SIN 3 to IN 3

d.SIN 4 to IN 4

8. Connect QPSK modulated signal MODOUT on ADCL -02 to the MOD IN of the

QPSK DEMODULATOR on ADCL-03

9. Connect I BIT, Q BIT and CLK OUT outputs of QPSK demodulator to I BIT IN,

Q BIT IN & CLK IN posts of data decoder respectively.

10. Observe various waveforms as mentioned below.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 35: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Block diagram of QPSK:

Block diagram for observation of constellation diagram:

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 36: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Connections:

ON KIT ADCL-02

1. Input NRZ-L data at DATA INPUT

2. Carrier frequency SIN 1 to SIN 4

3. Dibit pair generated data I BIT & Q BIT at DIBIT CONVERSION

4. QPSK modulated signal at MODOUT

ON KIT ADCL-03

1. Output of first squarer at SQUARER 1

2. Output of second squarer at SQUARER 2

3. Four sampling clocks at the output of SAMPLING CLOCK GENERATOR

4. Two Adder outputs at the output of ADDER

5. Recover data bits (I & Q bits) at the output of ENVELOPE DETECTOR

6. Recover NRZ-L data from I & Q bits at the output of DATA DECODER

Tabulation:

Description Amplitude in Volts Time in seconds

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 37: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Observation:

Observe the following waveforms on Oscilloscope and plot it on the paper.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 38: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Result:

Thus the modulated and demodulated waveforms are observed for QPSK

modulated technique.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 39: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Ex. No

PERFORMANCE EVALUATION OF QPSK MODULATION

USING MATLAB Date:

Aim:

To analyze the performance of QPSK Modulation using Matlab.

Apparatus Required:

1. Matlab 7 software.

2. Computer.

Theory:

The system performance of a digital communication network can be enhanced by

incorporating a coding technique, within the system, known as Gray coding. The gray

encoder is used to map the data in such a way as to help reduce bit errors.

A QPSK system takes the input data bits, two at a time, and creates a symbol that

represents one of four phase states. The gray encoder therefore is used to map every two

input data bits to one of four unique symbol values so that the bit pairs that are used to

generate the symbols are only one bit different from each adjacent symbol.

This technique proves to help with error performance because if a symbol is received in

error, it will contain only one error bit if it was received in error to an adjacent symbol.

Algorithm:

1. Introduce frame length.

2. Represent the range of SNR.

3. Convert Eb/No values to channel SNR.

4. Start the main calculation loop.

5. Keep going until you get 100 errors.

6. Generate information bits.

7. Introduce noise.

8. Calculate Bit Errors.

9. Receive data constellation.

10. Plot the BER Vs. SNR.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 40: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Program:

% Clear all the previously used variables and close all figures

% clear all;

% close all;

% format long;

% Frame Length

bit_count = 10000;

% Range of SNR over which to simulate

Eb_No = -3: 1: 7;

% Convert Eb/No values to channel SNR

% Consult BERNARD SKLAR'S book 'Digital Communications'

SNR = Eb_No + 10*log10(2);

% Start the main calculation loop

for aa = 1: 1: length(SNR)

% Initiate variables

T_Errors = 0;

T_bits = 0;

% Keep going until you get 100 errors

while T_Errors < 100

% Generate some information bits

uncoded_bits = round(rand(1,bit_count));

% Split the stream into two streams, for Quadrature Carriers

B1 = uncoded_bits(1:2:end);

B2 = uncoded_bits(2:2:end);

% QPSK modulator set to pi/4 radians constellation

% If you want to change the constellation angles

% just change the angles.

qpsk_sig = ((B1==0).*(B2==0)*(exp(i*pi/4))+(B1==0).*(B2==1)...

*(exp(3*i*pi/4))+(B1==1).*(B2==1)*(exp(5*i*pi/4))...

+(B1==1).*(B2==0)*(exp(7*i*pi/4)));

% Noise variance

N0 = 1/10^(SNR(aa)/10);

% Send over Gaussian Link to the receiver

rx = qpsk_sig +

sqrt(N0/2)*(randn(1,length(qpsk_sig))+i*randn(1,length(qpsk_sig)));

%---------------------------------------------------------------

% QPSK demodulator at the Receiver

B4 = (real(rx)<0);

B3 = (imag(rx)<0);

uncoded_bits_rx = zeros(1,2*length(rx));

uncoded_bits_rx(1:2:end) = B3;

uncoded_bits_rx(2:2:end) = B4;

% Calculate Bit Errors

diff = uncoded_bits - uncoded_bits_rx;

T_Errors = T_Errors + sum(abs(diff));

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 41: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

T_bits = T_bits + length(uncoded_bits);

end

% Received data constellation

figure; clf;

plot(real(rx),imag(rx),'o'); % Scatter Plot

title(['constellation of received symbols for SNR = ', num2str(SNR(aa))]);

xlabel('Inphase Component'); ylabel('Quadrature Component');

% Calculate Bit Error Rate

BER(aa) = T_Errors / T_bits;

disp(sprintf('bit error probability = %f',BER(aa)));

end

%------------------------------------------------------------

% Finally plot the BER Vs. SNR(dB) Curve on logarithmic scale

% BER through Simulation

figure(1);

semilogy(SNR,BER,'or');

hold on;

xlabel('SNR (dB)');

ylabel('BER');

title('SNR Vs BER plot for QPSK Modulation in Gaussian Environment');

Output:

bit error probability = 0.165000

bit error probability = 0.131100

bit error probability = 0.108000

bit error probability = 0.075600

bit error probability = 0.059600

bit error probability = 0.035800

bit error probability = 0.023300

bit error probability = 0.011800

bit error probability = 0.005100

bit error probability = 0.002300

bit error probability = 0.000831

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 42: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Observation:

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 43: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 44: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Result:

Thus the performance of QPSK modulation scheme using Matlab is verified.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 45: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Ex. No.:

PERFORMANCE EVALUATION OF PSK MODULATION

USING MATLAB Date:

Aim:

To analyze the performance of PSK Modulation using Matlab.

Apparatus Required:

1. Matlab 7 software.

2. Computer.

Theory:

Detection of PSK has been accomplished by comparing the received phase in a

given symbol interval with that in the previous symbol interval and making a decision on

difference between two phases.

The phase introduced by the channel is constant over the same two symbol

intervals and thus cancels when the above difference is taken.

Since in the absence of noise, the decision is equivalently being made on the

difference between two adjacent transmitted phases then in addition at the transmitter to

allow this phase difference to represent the input information to be communicated.

The encoding of the input information phase into the difference between two

adjacent transmitted phase.

Procedure:

1. Set the frame length.

2. Set the value of EbNo and SNR value.

3. Set the value of message sequence.

4. Modulate the given symbols using PSK modulation.

5. The modulated signal is then passed through the AWGN channel.

6. Plot the modulated signal values.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 46: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Program:

clc;

clear all;

close all;

EbNo=10;

snr=EbNo;

len=40;

m=16;

msg=randint(len,1,m);

txpsk=pskmod(msg,m);

scatterplot (txpsk);

title('psk plot');

rxpsk=awgn(txpsk,snr,'measured');

scatterplot(rxpsk);

title('noisy psk plot');

recovpsk=pskmod(rxpsk,m);

numberpsk=symerr(msg,recovpsk);

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 47: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Observation:

Result:

Thus the performance evaluation of PSK modulation is studied.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 48: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Ex. No.:

PERFORMANCE EVALUATION OF QAM MODULATION

USING MATLAB Date:

Aim:

To analyze the performance of QAM Modulation using Matlab.

Apparatus Required:

1. Matlab 7 software.

2. Computer.

Theory:

In I-Q modulation formed by quadrature carrier multiplexing two M-AM

modulation is called quadrature amplitude modulation (QAM). The signal constellation

corresponding to such a signal takes the form of a rectangular array of points in the form

of a square lattice. In M-AM modulation corresponds to a signal set of size 2^m, then

QAM signal set contains M= (2m) ² = 4m signals.

Procedure:

1. Convert the given binary digits of length 40 to symbols.

2. Perform QAM modulation for the given binary values.

3. The output of QAM signal is passed over a noisy channel whose SNR Eb/No = 10

4. The signal is demodulated and the BER is calculated.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 49: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Program:

%%set up%%

%% define parameters%%

M=16; %% size of signal constellation%%

k=log2(M); %% Number of bits per symbol%%

n=3e4; %%Number of bits to process%%

nsamp=1; %%over sampling rate%%

%% signal source%%

%% create a binary data stream as a column vector%%

x=randint(n,1); %%random binary data stream%%

%% plot first 40 bits in a stem plot%%

stem(x(1:40),'filled');

title ('Random Bits');

xlabel ('Bit Index');

ylabel('Binary Value');

%% Bit to symbol mapping%%

%% convert the bits in x into k bit symbols%%

xsym=bi2de(reshape(x,k,length(x)/k).','left-msb');

%% stem plot of symbols%%

%% plot first 10 symbols in a stem plot%%

figure; %% create new figure window%%

stem(xsym(1:10));

title('Random Symbols');

xlabel('Symbol Index');

ylabel('Integer Value');

%% Modulation%%

%% Modulate using 16 - QAM%%

y =qammod(xsym,M);

%% Transmitted signal%%

ytx=y;

%% channel%%

%% send signal over an AWGN channel%%

EbNo= 10; %% in dB%%

snr= EbNo + 10*log10(k) - 10*log10(nsamp);

ynoisy=awgn(ytx,snr,'measured');

%% Received Signal%%

yrx=ynoisy;

%% Scatter Plot%%

%% create scatter plot of noisy signal and transmitted%%

%% signal on the same axes%%

h=scatterplot(yrx(1:nsamp*5e3),nsamp,0,'g.');

hold on;

scatterplot(ytx(1:5e3),1,0,'k*',h);

title('Received Signal');

legend('Received Signal', 'Signal Constellation');

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 50: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

axis ([-5 5 -5 5]); %% set axis ranges%%

hold off;

%% Demodulation %%

%% Demodulate signal using 16 - QAM%%

zsym=qamdemod(yrx,M);

%%symbol to bit mapping%%

%%undo the bit to symbol mapping performed earlier%%

z=de2bi(zsym,'left-msb'); %% convert integers to bits%%

%% convert z from a matrix to a vector%%

z=reshape(z.',prod(size(z)),1);

%% BER Computation%%

%% Compare x and z to obtain the number of errors and the bit error rate%%

[number_of_errors,bit_error_rate]= biterr(x,z)

Output:

number_of_errors = 48

bit_error_rate = 0.0016

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 51: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Observations:

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 52: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Result:

Thus the performance evaluation of QAM modulation is studied.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 53: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Ex. No.:

DIGITAL DATA TRANSMISSION BETWEEN TWO

COMPUTERS THROUGH FIBER OPTIC LINK Date:

Aim:

To perform PC to PC Communication using fiber optic link.

Apparatus Required:

1. Link-B kit with power supply

2. 1-meter fiber cable

3. 9 pin D connector cable – 2Nos

4. Computers – PC -2Nos

5. Patch chords.

Theory:

Microprocessor is a parallel device. It transfers the 8, 16, 32 bit of data

simultaneously over the data lines. This is parallel I/O mode of data transfer. In many

situations, the parallel data transfer is impossible. This is very expensive and noisy

especially when the distances are large. In many scientific and industrial process control

applications, the devices under the control are at site or plant which may be long enough

from control room.

In these situations, the serial I/O mode is used when only one bit at a time is

transferred over a single cable. The cable may be normal cable or an optical fiber.

Very important advantage of serial mode of data transfer is that it is inexpensive and also

the data is accurately transferred and received in the link.

This plays vital role in many applications like PC-to PC data communication,

Industrial process controls, Robotics etc.

So it is necessary to have some system, which will perform serial I/O operation between

PC and outside device using optical fiber link. Link-B fulfils this need.

It provides the simplest and powerful way for serial communication through

optical fiber and is very easy to install & to use. One can enhance its flexibility through

software.

Function of RS-232C Transceiver:

The computer communicates from serial COM port, which is at RS232 levels i.e.

at 12v. Transceiver MAX 232 performs the function of converting RS232C signals to

TTL levels or vice versa.

Hardware Settings:

To perform this experiment, the COM ports of PC are used. On board 9-pin-D

type (female) connectors are provided for interfacing with the PC. Connect the D-type

female connector end of one cable to one of the COM ports of the PC and 9-pin D-type

connector end to CN6. Similarly connect other cable to other port and CN7.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 54: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Connection Diagram:

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 55: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Procedure:

1. Make connections as shown in the figure. Connect the power supply cables with

proper polarity to link-B kit.

2. Keep switch SW8 towards TX position.

3. Keep switch SW9 towards TX1 position.

4. Keep switch SW10 towards TTL position.

5. Keep jumper JP5 towards +5V position.

6. Keep jumper JP6 shorted.

7. Keep the jumper JP8 towards pulse position.

8. Connect one end of 9 to 9 pin cable to PC COM1 port and other end to CN6

connector on LINK-B kit, and then connect second 9 to 9 pin cable one end to

second PC COM1 port and other end to CN7 connector on LINK-B kit.

9. Switch on the power supply.

10. Connect COM1 port on the kit (RS-232 selection) to IN port of digital buffer

section.

11. Connect the port OUT of digital buffer to the port TX IN of transmitter.

12. Slightly unscrew the cap of LED SFH756V (660 nm) on kit. Do not remove the cap

from connector. Once the cap is loosened, insert the one meter fiber into the cap.

Now tight the cap by screwing it back.

13. Slightly unscrew the cap of RX1 phototransistor with TTL logic output SFH551V.Do

not remove the cap from connector. Once the cap is loosened, insert the other end of

the fiber into the cap. Now tight the cap by screwing it back.

14. Connect the TTL OUT port of receiver section COM2 port on the kit(RS-232

section).

15. After putting ON one of the PC, go to START MENU, PROGRAMS,

ACCESSORIES, COMMUNICATION and click on HYPER TERMINAL.

16. A new window will open where double clicking on HYPERTRM, two windows will

open, one at the background and another (small window) with title connection

description which will be active.

17. Enter the name in the box by which we would like to store our connection eg: pc2pc

and click OK and select the icon provided below. The background window title will

change to the name provide by us.

18. Then specify connect using: By selecting Direct to COM1 or where the cable is

connected and click OK. In the window, set

Country Code: India (91)

Area Code : 91

Connect using: Direct to COM1 or COM1

Click OK

19. Check the port we have selected and ports we are connecting.

20. Now the window with title COM1 properties will appear where the port settings

should be done.

Port Settings:

Bits per seconds: 9600

Data bits : 8

Parity : none

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 56: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Stop bits : 1

Flow control : XON/ XOFF

Click OK

21. Bits per second could be selected for different speeds. Do not exceed it above

115200 bps.

22. Click OK after the above settings. The background window will become active.

RECEIVER PC:

23. To receive the file on the PC click on the TRANSFER menu and again click on

Receive file. A window will prompted having the title Receive file with location at

which we want to store the Received file and Receiving Protocol.

24. Select Browse for location where we like to store the receiving file, select folder

and click OK. The folder name and address will be displayed in small window.

Protocol should be Kermit which should be set in transmitting PC too.

Place received file in the following folder

C:\\:Desktop

Use received protocol:

25. Click on FILE, SAVE AS and save it in the directory we want.

26. Perform the same on the other computer

27. To start communicating between two PCs click on the TRANSFER menu and again

click on SEND FILE. A window will be prompted having the title send file with file

name and protocol.

28. Select BROWSE for the file, which we like to send to the PC connected, select the

file and click ok. Click on OPEN the file name and the address will displayed in

small window. Then select KERMIT protocol

29. On the PC from which the selected file to be transmitted, click SEND. A window

will open showing the file transfer status. Immediately at the receiving PC click

RECEIVE. A window showing file is begun received in the form of packets will

appear.

30. After the file is transmitted both the windows in transmitting and receiving PCs will

close. Check the received file on the folder where the file is stored.

Result: Thus the file transfer between two PCs was established using fiber optic link.

Browse

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 57: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Ex. No.:

PERFORMANCE EVALUATION OF DIGITAL DATA

TRANSMISSION USING MATLAB Date:

Aim:

To perform the evaluation of digital data transmission using MATLAB and hence

to calculate Bit rate, BER and power budget.

Apparatus Required:

1. Matlab Software.

2. PC

Theory:

Preparatory Information:

The principle components of a general optic fiber communication

system for either a digital (or) analog transmission. The transmit terminal equipment

consists of an information encoder (or) signal shaping circuit proceeding a modulation

(or) electronic driver stage which operates the optical source. Light emitted from the

source is launched medium. The light emerging from the far end of the transmission

medium is converted back into an electrical signal by an optical detector.

Digital Transmission:

The modulator employs intensity modulation for conversion of

electrical signals to optical signals. The operation of the LED for binary digital

transmission requires the switching ON and OFF of a current in the range of several tens

to several hundreds of milli amperes.

Digital Reception:

The optical detector performs the linear conversion of the received optical

signal into an electrical current. A photo transistor occupies this position where it detects

the light falling upon from the output of the fiber cable and generates the current signal

proportional to it. For instance, the received optical signal may be distorted due to the

dispersive mechanism, with in the optical fiber.

Procedure:

1. Set the value for source power loss, attenuation, loss bit, and margin.

2. Set the transmission and received bit value.

3. Find out the fiber loss by the mathematical expression is given by Lf=At*L

Where, At = Attenuation; L = Length.

4. Find out the coupling loss in the fiber, Cl= - 10*log (NA*NA)

Where, NA = Numerical aperture of the fiber.

5. Find the bit rate and bit error probability of the fiber.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 58: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Program:

clc;

clear all;

close all;

Ps=22; % source power loss mW

NA=0.89; %NA fiber

At=0.22; %attenuation db

L=20; %length km

Ap=-35; %acceptable power

Al=4; %allowed margin

Ps1=0.3; %splice loss

C=2; %average loss db

Tb=0.2; % transmitted bit

Tr=0.4; %received bit

Cl=-10*log(NA*NA); %coupling loss

Lf=At*L; %fiber loss

Lc=0.5; %connector loss

Pm=Lc; %Design margining

Pout=Ps-(Cl+Lf+Pm);

BER=Tr/Tb;

Bitrate=1/Tb;

disp(Pout);

disp(Cl);

disp(Lf);

disp(Lc);

disp(BER);

disp(Bitrate);

Observation:

Pout = 14.7693

Cl = 2.3307

Lf = 4.4000

Lc = 0.5000

BER = 2

Bit rate = 5

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 59: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Result:

Thus the performance evaluation of digital data transmission using MATLAB

coding was performed and Bit rate, BER & power budget were calculated.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 60: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Ex. No.:

PERFORMANCE EVALUATION OF DIGITAL DATA

TRANSMISSION THROUGH FIBER OPTIC LINK Date:

Aim:

To establish the digital optical link and hence to calculate Numerical aperture of

the fiber and source power of the fiber.

Apparatus Required:

1. Fiber optic kit

2. CRO

3. Function generator

4. Fiber optic cable

5. Patch chords

6. Power supply

Theory:

Preparatory Information:

The principle components of a general optic fiber communication

system for either a digital (or) analog transmission. The transmit terminal equipment

consists of an information encoder (or) signal shaping circuit proceeding a modulation

(or) electronic driver stage which operates the optical source. Light emitted from the

source is launched medium. The light emerging from the far end of the transmission

medium is converted back into an electrical signal by an optical detector.

Digital Transmission:

The modulator employs intensity modulation for conversion of

electrical signals to optical signals. The operation of the LED for binary digital

transmission requires the switching ON and OFF of a current in the range of several tens

to several hundreds of milli amperes.

Digital Reception:

The optical detector performs the linear conversion of the received optical

signal into an electrical current. A photo transistor occupies this position where it detects

the light falling upon from the output of the fiber cable and generates the current signal

proportional to it. For instance, the received optical signal may be distorted due to the

dispersive mechanism, with in the optical fiber.

Note:

The wavelength for the LED source 800 to 900 nm.

The wavelength for the LASER source around 1300 nm.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 61: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Procedure:

1. Set the switch SW8 to the DIGITAL POSITION

2. Connect the 1m optical fiber between LED1 and the PIN DIODE PD1

3. Remove the shorting plugs of the coded data shorting links,S6 in the Manchester

coder block and S26 in the decoder and clock recovery block

4. Ensure that the shorting plug of jumper JP2 is across the posts A &B

5. Feed a TTL signal of about 20KHz from the function generator to post B of S6

Down (I/O2)

TTL Down (I/O2)

UP (I/O2) (I/O3)S6(post B)

6. Observe the received signal in the CRO at post A of S 26

Down (I/O1) CRO (Channel 1)

UP (I/O1) S26 (post A)

B

Formulae:

Numerical aperture (N.A) = r / √h²+r²

Where, D E

R = radius of the light spot.

H = height of the fiber cable

Distance (d) = (DE + BC) / 4

D = distance between fiber end and illumination

C

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 62: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Block diagram:

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 63: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Tabulation:

Input Voltage: Time period:

S.No Frequency

(Hz)

Ton Toff Bit rate

1/Ton

Duty cycle

Ton / (Ton+Toff)

Numerical Aperture: Source power (Ps) =

S.No Height of the fiber from

base (h) in cm

Diameter of the

light (d) in cm

R = d/2 NA

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 64: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Calculation:

Result:

Thus the digital optical link was established and Bit rate, numerical aperture of

the fiber were calculated.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 65: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Ex. No.:

IMPLEMENTATION OF CYCLIC CODES

Date:

Aim:

To write a MATLAB program to encode all possible data words and decode all

the encoded words.

Apparatus Required:

1. MATLAB 7 software

2. Computer

Theory:

Linear cyclic codes have the property of linearity, i.e. the sum of any two

codeword‟s is also a code word, and they are applied to the source bits in blocks, hence

the name linear cyclic codes. There are block codes that are not linear, but it is difficult to

prove that a code is a good one without this property.

In coding theory, a linear code is an error-correcting code for which any linear

combination of code words is also a codeword. Linear codes are traditionally partitioned

into block codes and convolution 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 (cf. syndrome decoding).

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 codeword 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.

Algorithm:

1. Generate a sequence.

2. Encode the message bits.

3. Decode the sequence.

4. Add a noise.

5. Compute error rate for decoding the noisy code.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 66: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Program:

n = 6;

k = 3;

i=2^k

msg = randint(i,k,[0,1]) % 100 messages, k bits each

G = [1 0 0 0 1 1;

0 1 0 1 0 1;

0 0 1 1 1 0]

c=rem(msg*G,2)

code = encode(msg,n,k,'cyclic/binary')

dcode= decode(code,n,k,'cyclic/binary')

noisycode = rem(code + randerr(i,n,2), 2) % Add noise.

newmsg = decode(noisycode,n,k,'cyclic') % Decode.

% % Compute error rate for decoding the noisy code.

[number,ratio] = biterr(newmsg,msg)

disp(['The bit error rate is ',num2str(ratio)])

Observations:

i = 8

msg = 0 1 0

1 1 0

1 1 0

0 0 0

1 1 0

1 1 1

1 0 0

0 0 1

G = 1 0 0 0 1 1

0 1 0 1 0 1

0 0 1 1 1 0

c = 0 1 0 1 0 1

1 1 0 1 1 0

1 1 0 1 1 0

0 0 0 0 0 0

1 1 0 1 1 0

1 1 1 0 0 0

1 0 0 0 1 1

0 0 1 1 1 0

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 67: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

code = 0 1 0 0 1 0

1 1 0 1 1 0

1 1 0 1 1 0

0 0 0 0 0 0

1 1 0 1 1 0

1 1 1 1 1 1

1 0 0 1 0 0

0 0 1 0 0 1

Single-error patterns loaded in decoding table. 4 rows remaining.

2-error patterns loaded. 1 rows remaining.

3-error patterns loaded. 0 rows remaining.

dcode = 0 1 0

1 1 0

1 1 0

0 0 0

1 1 0

1 1 1

1 0 0

0 0 1

noisycode = 1 0 0 0 1 0

0 1 0 1 0 0

0 1 1 1 1 0

0 0 1 0 0 1

1 1 0 0 1 1

1 0 0 1 1 1

1 1 0 0 0 0

1 0 0 0 0 1

Single-error patterns loaded in decoding table. 4 rows remaining.

2-error patterns loaded. 1 rows remaining.

3-error patterns loaded. 0 rows remaining.

newmsg = 0 1 0

1 0 0

1 1 0

0 0 1

0 1 1

1 1 1

0 0 0

0 0 1

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 68: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Number = 5

Ratio = 0.2083

The bit error rate is 0.20833

Result:

Thus the linear cyclic code was implemented using MATLAB.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 69: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Ex. No.:

IMPLEMENTATION OF BLOCK CODES

Date:

Aim:

To write a MATLAB program to encode all possible data words and decode all

the encoded words using linear block codes.

Apparatus Required:

1. MATLAB 7 software

2. Computer

Theory:

In an (n,k) linear block code the first portion of „k‟ bits is always identical to the

message sequences to be transmitted. The (n,k) bits in the second portion are computed

from the message bits in accordance with the prescribed encoding rule that determine the

mathematical structure of the code.

According these (n,k) bits are referred to as generalized parity check bits (or)

simply parity bits. Block codes in which the given messages sequences are transmitted in

unaltered form are called as systematically codes. For the application requiring error

detection and error correction on the use of systematic block codes simplifies the

implementation of the decoder.

The generator matrix is used in encoding operation done at the transmitter. The

parity check matrix is used in decoding operation done at the receiver. The algorithm

commonly used to perform decoding operation starts with the computation of 1 by (n,k)

vector is called as the error syndrome vector (or) simply syndrome.

It has many important properties, the syndrome depends only the error pattern and

not on the transmitter and code words. All the error patterns that differ at most by the

code word have the same syndrome. The syndrome is the sum of those columns of the

matrix (H), corresponding the error locations.

Hamming distance: it is defined as the smallest hamming distance between pair of code

word in the given code.

Procedure:

1. Find parity check matrix and generator matrix using "hammgen" function.

2. Find parity check matrix and generator matrix for (n,k) cyclic code

3. Represent the message in the polynomial form

4. Convert the generator matrix for a (n,k) linear block codes into corresponding

parity check matrix

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 70: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Program:

clc;

clear all;

close all;

n=6;

k=3;

genmat=[[1 0 0; 1 1 1; 0 0 1],eye(3)]; %% Generator Matrix %%

msg=[1 1 0; 1 0 1; 1 0 0; 1 1 1]; %% Message Polynomial %%

code=encode(msg,n,k,'linear',genmat); %% Code word polynomial %%

noisycode=rem(code+randerr(4,n,[0 1; .6 .4]),2);

trt=zeros(2^(n-k),n);

[newmsg,err]=decode(noisycode,n,k,'linear',genmat,trt);

disp('message');

disp(msg);

disp('encoded message');

disp(code);

disp('noise');

disp(noisycode);

disp('new message');

disp(newmsg);

err_words=find(err~=0);

disp('error words');

disp(err_words);

Output:

Message

1 1 0

1 0 1

1 0 0

1 1 1

Encoded message

0 1 1 1 1 0

1 0 1 1 0 1

1 0 0 1 0 0

0 1 0 1 1 1

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 71: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Noise

0 1 1 0 1 0

1 0 1 1 0 1

1 0 0 1 0 0

0 1 1 1 1 1

New message

0 1 0

1 0 1

1 0 0

1 1 1

Error words

1

4

Result:

Thus the linear block code was implemented using MATLAB.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 72: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Ex. No.:

OFDM TRANSCEIVER DESIGN USING MATLAB

Date:

Aim:

To write a MATLAB program to demonstrate orthogonally frequency division

multiplexing (OFDM).

Apparatus Required:

1. MATLAB 7 software

2. Computer

3.

Theory:

Frequency division multiplexing (FDM) is a technology that transmits multiple

signals simultaneously over a single transmission path, such as a cable or wireless

system. Each signal travels within its own unique frequency range (carrier), which is

modulated by the data (text, voice, video, etc.).

Orthogonal FDM's (OFDM) spread spectrum technique distributes the data over a

large number of carriers that are spaced apart at precise frequencies. This spacing

provides the "orthogonality" in this technique which prevents the demodulators from

seeing frequencies other than their own. The benefits of OFDM are high spectral

efficiency, resiliency to RF interference, and lower multi-path distortion. This is useful

because in a typical terrestrial broadcasting scenario there are multipath-channels (i.e. the

transmitted signal arrives at the receiver using various paths of different length). Since

multiple versions of the signal interfere with each other (inter symbol interference (ISI))

it becomes very hard to extract the original information. OFDM is sometimes called

multi-carrier or discrete multi-tone modulation. It is the modulation technique used for

digital TV in Europe, Japan and Australia.

Algorithm:

1. Represent the number of bits per OFDM symbol

2. Select the number of symbols

3. Select FFT size

4. Select modulation order

5. Introduce symbol to noise ratio

6. SNR to be used by AWGN function

7. Generating data and Modulating data

8. Serial to parallel conversion

9. Pilot insertion

10. Adding cyclic prefix

11. Parallel to serial conversion

12. Passing through the channel

13. Pilot removal and plotting the result.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 73: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Program (Using BPSK):

close all;

clear all;

clc;

nbitpersym = 52; % number of bits per OFDM symbol (same as the number of

subcarriers for BPSK)

nsym = 10^4; % number of symbols

len_fft = 64; % fft size

sub_car = 52; % number of data subcarriers

EbNo = 0:2:12;

M= 2; % Modulation order

EsNo= EbNo + 10*log10(52/64)+ 10*log10(64/80); % symbol to noise ratio

snr=EsNo - 10*log10(52/64); % snr as to be used by awgn fn.

% Generating data

t_data=randint(nbitpersym*nsym,1);

% modulating data

mod_data = pskmod(t_data, M);

% serial to parallel conversion

par_data = reshape(mod_data,nbitpersym,nsym).';

% pilot insertion

pilot_ins_data=[zeros(nsym,6) par_data(:,[1:nbitpersym/2]) zeros(nsym,1)

par_data(:,[nbitpersym/2+1:nbitpersym]) zeros(nsym,5)] ;

% fourier transform time doamain data and normalizing the data

IFFT_data = (64/sqrt(52))*ifft(fftshift(pilot_ins_data.')).';

% addition cyclic prefix

cylic_add_data = [IFFT_data(:,[49:64]) IFFT_data].';

% parallel to serial coversion

ser_data = reshape(cylic_add_data,80*nsym,1);

% passing thru channel

no_of_error=[];

ratio=[];

for ii=1:length(snr)

chan_awgn = sqrt(80/52)*awgn(ser_data,snr(ii),'measured'); % awgn addition

ser_to_para = reshape(chan_awgn,80,nsym).'; % serial to parallel coversion

cyclic_pre_rem = ser_to_para(:,[17:80]); %cyclic prefix removal

FFT_recdata =(sqrt(52)/64)*fftshift(fft(cyclic_pre_rem.')).'; % freq domain transform

rem_pilot = FFT_recdata (:,[6+[1:nbitpersym/2] 7+[nbitpersym/2+1:nbitpersym] ]);

%pilot removal

ser_data_1 = reshape(rem_pilot.',nbitpersym*nsym,1); % serial coversion

demod_Data = pskdemod(ser_data_1, M); %demodulating the data

[no_of_error(ii),ratio(ii)]=biterr(t_data,demod_Data) ; % error rate calculation

end

% plotting the result

semilogy(EbNo,ratio,'--or','linewidth',2);

hold on;

theoryBer = (1/2)*erfc(sqrt(10.^(EbNo/10)));

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 74: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

semilogy (EbNo,theoryBer,'--*b','linewidth',2);

grid on

axis([0 12 10^-5 .1])

xlabel('EbNo');

ylabel('BER')

title('Bit error probability curve for BPSK using OFDM');

Observation:

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 75: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Program (Using BPSK with Rayleigh Channel):

% Script for computing the BER for BPSK in OFDM modulation in the

% presence of Rayeligh fading channel

% parameters

% FFT size. nFFT 64

% Number of used subcarriers. nDSC 52

% FFT Sampling frequency 20MHz

% Subcarrier spacing 312.5kHz

% Used subcarrier index -26 to -1, +1 to +26

% Cylcic prefix duration, Tcp 0.8us

% Data symbol duration, Td 3.2us

% Total Symbol duration, Ts 4us

clear all

nFFT = 64; % fft size

nDSC = 52; % number of data subcarriers

nBitPerSym = 52; % number of bits per OFDM symbol (same as the number of

subcarriers for BPSK)

nSym = 10^4; % number of symbols

EbN0dB = [0:35]; % bit to noise ratio

EsN0dB = EbN0dB + 10*log10(nDSC/nFFT) + 10*log10(64/80); % converting to

symbol to noise ratio

for ii = 1:length(EbN0dB)

% Transmitter

ipBit = rand(1,nBitPerSym*nSym) > 0.5; % random 1's and 0's

ipMod = 2*ipBit-1; % BPSK modulation 0 --> -1, 1 --> +1

ipMod = reshape(ipMod,nBitPerSym,nSym).'; % grouping into multiple symbolsa

% Assigning modulated symbols to subcarriers from [-26 to -1, +1 to +26]

xF = [zeros(nSym,6) ipMod(:,[1:nBitPerSym/2]) zeros(nSym,1)

ipMod(:,[nBitPerSym/2+1:nBitPerSym]) zeros(nSym,5)] ;

% Taking FFT, the term (nFFT/sqrt(nDSC)) is for normalizing the power of transmit

symbol to 1

xt = (nFFT/sqrt(nDSC))*ifft(fftshift(xF.')).';

% Appending cylic prefix

xt = [xt(:,[49:64]) xt];

% multipath channel

nTap = 10;

ht = 1/sqrt(2)*1/sqrt(nTap)*(randn(nSym,nTap) + j*randn(nSym,nTap));

% computing and storing the frequency response of the channel, for use at recevier

hF = fftshift(fft(ht,64,2));

% convolution of each symbol with the random channel

for jj = 1:nSym

xht(jj,:) = conv(ht(jj,:),xt(jj,:));

end

xt = xht;

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 76: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

% Concatenating multiple symbols to form a long vector

xt = reshape(xt.',1,nSym*(80+nTap-1));

% Gaussian noise of unit variance, 0 mean

nt = 1/sqrt(2)*[randn(1,nSym*(80+nTap-1)) + j*randn(1,nSym*(80+nTap-1))];

% Adding noise, the term sqrt(80/64) is to account for the wasted energy due to cyclic

prefix

yt = sqrt(80/64)*xt + 10^(-EsN0dB(ii)/20)*nt;

% figure

% plot(real(yt));grid on;

% Receiver

yt = reshape(yt.',80+nTap-1,nSym).'; % formatting the received vector into symbols

yt = yt(:,[17:80]); % removing cyclic prefix

% converting to frequency domain

yF = (sqrt(nDSC)/nFFT)*fftshift(fft(yt.')).';

% equalization by the known channel frequency response

yF = yF./hF;

% extracting the required data subcarriers

yMod = yF(:,[6+[1:nBitPerSym/2] 7+[nBitPerSym/2+1:nBitPerSym] ]);

% BPSK demodulation

% +ve value --> 1, -ve value --> -1

ipModHat = 2*floor(real(yMod/2)) + 1;

ipModHat(ipModHat>1) = +1;

ipModHat(ipModHat<-1) = -1;

% converting modulated values into bits

ipBitHat = (ipModHat+1)/2;

ipBitHat = reshape(ipBitHat.',nBitPerSym*nSym,1).';

% counting the errors

nErr(ii) = size(find(ipBitHat - ipBit),2);

end

simBer = nErr/(nSym*nBitPerSym);

close all;

semilogy(EbN0dB,simBer,'mx-','LineWidth',2);

axis([0 35 10^-5 1])

grid on

legend('Rayleigh-Simulation');

xlabel('Eb/No, dB');

ylabel('Bit Error Rate');

title('BER for BPSK using OFDM in a 10-tap Rayleigh channel');

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 77: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Observation:

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 78: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Program (Using QAM):

close all;

clear all;

clc;

% Generating and coding data

t_data=randint(9600,1)';

x=1;

si=1; %for BER rows

for d=1:100;

data=t_data(x:x+95);

x=x+96;

k=3;

n=6;

s1=size(data,2); % Size of input matrix

j=s1/k;

% Convolutionally encoding data

constlen=7;

codegen = [171 133]; % Polynomial

trellis = poly2trellis(constlen, codegen);

codedata = convenc(data, trellis);

%Interleaving coded data

s2=size(codedata,2);

j=s2/4;

matrix=reshape(codedata,j,4);

intlvddata = matintrlv(matrix',2,2)'; % Interleave.

intlvddata=intlvddata';

% Binary to decimal conversion

dec=bi2de(intlvddata','left-msb');

%16-QAM Modulation

M=16;

y = qammod(dec,M);

% scatterplot(y);

% Pilot insertion

lendata=length(y);

pilt=3+3j;

nofpits=4;

k=1;

for i=(1:13:52)

pilt_data1(i)=pilt;

for j=(i+1:i+12);

pilt_data1(j)=y(k);

k=k+1;

end

end

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 79: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

pilt_data1=pilt_data1'; % size of pilt_data =52

pilt_data(1:52)=pilt_data1(1:52); % upsizing to 64

pilt_data(13:64)=pilt_data1(1:52); % upsizing to 64

for i=1:52

pilt_data(i+6)=pilt_data1(i);

end

ifft_sig=ifft(pilt_data',64); % IFFT

% Adding Cyclic Extension

cext_data=zeros(80,1);

cext_data(1:16)=ifft_sig(49:64);

for i=1:64

cext_data(i+16)=ifft_sig(i);

end

% Channel

% SNR

o=1;

for snr=0:2:50

ofdm_sig=awgn(cext_data,snr,'measured'); % Adding white Gaussian Noise

% figure;

% index=1:80;

% plot(index,cext_data,'b',index,ofdm_sig,'r'); %plot both signals

% legend('Original Signal to be Transmitted','Signal with AWGN');

% RECEIVER

%Removing Cyclic Extension

for i=1:64

rxed_sig(i)=ofdm_sig(i+16);

end

% FFT

ff_sig=fft(rxed_sig,64);

% Pilot Synch%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

for i=1:52

synched_sig1(i)=ff_sig(i+6);

end

k=1;

for i=(1:13:52)

for j=(i+1:i+12);

synched_sig(k)=synched_sig1(j);

k=k+1;

end

end

% scatterplot(synched_sig)

dem_data= qamdemod(synched_sig,16); % Demodulation

% Decimal to binary conversion

bin=de2bi(dem_data','left-msb');

bin=bin';

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 80: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

% De-Interleaving

deintlvddata = matdeintrlv(bin,2,2); % De-Interleave

deintlvddata=deintlvddata';

deintlvddata=deintlvddata(:)';

%Decoding data

n=6;

k=3;

decodedata =vitdec(deintlvddata,trellis,5,'trunc','hard'); % decoding datausing veterbi

decoder

rxed_data=decodedata;

% Calculating BER

rxed_data=rxed_data(:)';

errors=0;

c=xor(data,rxed_data);

errors=nnz(c);

% for i=1:length(data)

%

%

% if rxed_data(i)~=data(i);

% errors=errors+1;

%

% end

% end

BER(si,o)=errors/length(data);

o=o+1;

end % SNR loop ends here

si=si+1;

end % main data loop

% Time averaging for optimum results

for col=1:25; %%%change if SNR loop Changed

ber(1,col)=0;

for row=1:100;

ber(1,col)=ber(1,col)+BER(row,col);

end

end

ber=ber./100;

%%

figure

i=0:2:48;

semilogy(i,ber);

title('BER vs SNR');

ylabel('BER');

xlabel('SNR (dB)');

grid on

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 81: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Observation:

Result:

Thus the simulation for OFDM using BPSK and QAM modulation was done

using MATLAB SOFTWARE.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 82: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Ex. No.:

DETERMINATION OF GUIDE WAVELENGTH AND

FREQUENCY MEASUREMENT Date:

Aim:

To measure the frequency and wavelength of microwave

oscillator and to demonstrate the relationship between frequency guide and space

wavelength.

Apparatus Required:

1. Klystron power supply

2. Klystron mount

3. Isolator

4. Variable attenuator

5. Frequency meter

6. Slotted line section

7. Detector mount

8. Matched termination

9. Movable shot

10. CRO and Probe

Theory:

It uses only a single re-entrant microwave cavity as a resonator. The electron

beam emitted from the cathode is accelerated by the grid and passes through the cavity

anode to the repeller space between the cavity anode and the repeller electrode. The

feedback required to maintain oscillations within the cavity is obtained by reversing the

electron beam emitted from cathode towards repeller electrode and sending it back

through the cavity. The electrons in the beam are velocity modulated before the beam

passes through the cavity second time and will give up the energy to cavity to maintain

oscillations. This type of klystron oscillator is called as a reflex klystron because of the

reflex action of the electron beam. The physical design of the tube controls the no. of

modes possible in practical applications. The bunched electrons in a reflex klystron can

deliver maximum power to the cavity at any instant which corresponds to the positive

peak of the RF cycle of the cavity oscillation. The power output of a reflex klystron is

maximum, if the bunched electrons on return cross the cavity gap when the gap field is

positive maximum.

Precautions:

1. Before switch ON the power supply, ensure that all the knob are kept in minimum

position.

2. Switch ON the power supply, set the beam voltage between 230V to 270V.

3. Set the beam current in the range of 17mAmps to 20 mAmps. Always the repller

voltage having negative value it should be in the range of 160V to 200V.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 83: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Block diagram:

Formulae:

1. λo = C/fo ( C = 3*10^8m or 3*10^10cm)

2. λg = 2 (d1~d2)

3. λo‟ = λg*λc/√λg²+λc²

4. λc = 2a (a = 2.3cm)

5. fo‟ = c/λo‟

Isolator

CRO

Klystron

Power Supply

Detector

Mount

Slotted Line

Section

Frequency

Meter

Variable

Attenuator

Klystron

Mount

www.Vidyarthiplus.com

www.Vidyarthiplus.com

Page 84: M.E., COMMUNICATION SYSTEMS CU 9216 - COMMUNICATION …

Page No.

CU 9216 COMMUNICATION SYSTEM LABORATORY - I

Procedure:

1. The connections are made as per the block diagram.

2. Before switching ON the klystron tube, check the beam voltage and repeller

voltage are kept in minimum.

3. Switch ON the power supply and set the beam current as 17mA to 23mA.

4. Then the frequency mater is tuned to get a dip in the CRO and the frequency

reading from the meter is noted as „fo‟. The frequency meter is detuned after the

reading is taken down.

5. The position of the slotted line section is varied to get the minimum point (zero

output in the CRO). The position of the tunable probe is noted from the scale

provided in the slotted line section as „d1‟.

6. The tunable probe is moved in the same direction as above and the vary next

minima is found and noted as „d2‟.

7. From the above values, find λo, λg, λo‟ and fo can be calculated using the

equations.

Tabulation:

Frequency of

oscillation in

GHz (fo)

Position of minima

λo in cm

λg in cm

λo’ in cm

fo’ in GHz

d1 in cm d2 in cm

Calculations:

Result:

Thus the frequency and wave length of the microwave oscillator is measured

and the relationship between frequency guide and free space wavelength is measured.

www.Vidyarthiplus.com

www.Vidyarthiplus.com