0% found this document useful (0 votes)
11 views17 pages

Exp1 Communication

Uploaded by

Moh'd Mufeed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views17 pages

Exp1 Communication

Uploaded by

Moh'd Mufeed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Communication Lab - Assignment 1

Muhammed Mufeed M
Devapriya J K
Anamika P
30 July 2024

1
1 Familiarise communication Toolbox in MAT-
LAB/Octave
1.1 Commands in Communications
– awgn
Add white Gaussian noise to a voltage signal.

– biterr
Compares two matrices and returns the number of bit errors and the bit
error rate.
– eyediagram
Plot the eye-diagram of a signal.

– randerr
Generate a matrix of random bit errors.
– randint
Generate a matrix of random binary numbers.

– randsrc
Generate a matrix of random symbols.
– scatterplot
Display the scatter plot of a signal.

– symerr
Compares two matrices and returns the number of symbol errors and the
symbol error rate.
– wgn
Returns a M-by-N matrix Y of white Gaussian noise.

– bsc
Send DATA into a binary symmetric channel with probability P of error
one each symbol.

1.2 Source Coding


– compand
Compresses and expands the dynamic range of a signal using a mu-law or
A-law algorithm.

– dpcmdeco
Decode using differential pulse code modulation (DPCM).
– dpcmenco
Encode using differential pulse code modulation (DPCM).

2
– dpcmopt
Optimize the DPCM parameters and codebook.
– huffmandeco
Decode signal encoded by huffmanenco.

– huffmandict
Builds a Huffman code, given a probability list.
– huffmanenco
Returns the Huffman encoded signal using DICT.
– lloyds
Optimize the quantization table and codes to reduce distortion.
– lz77deco
Lempel-Ziv 77 source algorithm decoding implementation.
– lz77enco
Lempel-Ziv 77 source algorithm implementation.
– quantiz
Quantization of an arbitrary signal relative to a partitioning.
– shannonfanodict
Returns the code dictionary for source using Shannon-Fano algorithm.

– shannonfanoenco
Returns the Shannon-Fano encoded signal using DICT.
– shannonfanodeco
Returns the original signal that was Shannon-Fano encoded.

– rleenco
Returns run-length encoded MESSAGE.
– rledeco
Returns decoded run-length MESSAGE.

– riceenco
Returns the Rice encoded signal using K or optimal K.
– ricedeco
Returns the Rice decoded signal vector using CODE and K.
– fiboenco
Returns the cell-array of encoded Fibonacci value from the column vectors
NUM.
– fibodeco
Returns the decoded Fibonacci value from the binary vectors CODE.

3
– fibosplitstream
Returns the split data stream at the word boundaries.
– golombenco
Returns the Golomb coded signal as cell array.

– golombdeco
Returns the Golomb decoded signal vector using CODE and M.

1.3 Block Interleavers


– intrlv
Interleaved elements of DATA according to ELEMENTS.
– helscanintrlv
NROWS-by-NCOLS.

– matintrlv
Interleaved elements of DATA with a temporary matrix of size NROWS-
by-NCOLS.
– randintrlv
Interleaves elements of DATA with a random permutation.

– deintrlv
Restore elements of DATA according to ELEMENTS.
– matdeintrlv
Restore elements of DATA with a temporary matrix of size NROWS-by-
NCOLS.

– randdeintrlv
Restore elements of DATA with a random permutation.

1.4 Block Coding


– bchdeco
Decodes the coded message CODE using a BCH coder.
– bchenco
Encodes the message MSG using a [N,K] BCH coding.

– bchpoly
Calculates the generator polynomials for a BCH coder.
– convenc
Encode the binary vector MSG with the convolutional encoder described
by the trellis structure T.

4
– cyclgen
Produce the parity check and generator matrix of a cyclic code.
– cyclpoly
Returns the cyclic generator polynomials of the code [N,K].

– decode
Top level block decoder.
– encode
Top level block encoder.
– egolaydec
Decode Extended Golay code.
– egolayenc
Encode with Extended Golay code.
– egolaygen
Extended Golay code generator matrix.
– gen2par
Converts binary generator matrix GEN to the parity check matrix PAR
and visa-versa.
– hammgen
Produce the parity check and generator matrices of a Hamming code.
– reedmullerdec
Decode the received code word VV using the RM-generator matrix G, of
order R, M, returning the code-word C.

– reedmullerenc
Definition type construction of Reed-Muller code, of order R, length 2M .
– reedmullergen
Definition type construction of Reed-Muller code, of order R, length 2M .
– rsgenpoly
Creates a generator polynomial for a Reed-Solomon coding with message
length of K and codelength of N.
– rsdec
Decodes the message contained in CODE using a [N,K] Reed-Solomon
code.

– rsdecof
Decodes an ASCII file using a Reed-Solomon coder.
– rsenc
Encodes the message MSG using a [N,K] Reed-Solomon coding.

5
– rsencof
Encodes an ASCII file using a Reed-Solomon coder.
– systematize
Given G, extract P parity check matrix.
– syndtable
Create the syndrome decoding table from the parity check matrix H.

1.5 Modulations
– ademodce
Baseband demodulator for analog signals.
– amodce
Baseband modulator for analog signals.
– ammod
Creates the AM modulation of the amplitude signal X with carrier fre-
quency FC.
– amdemod
Creates the AM demodulation of the signal S sampled at frequency FS
with carrier frequency FC.
– apkconst
Plots an ASK/PSK signal constellation.
– bin2gray
Creates a Gray encoded data Y with the same size as input X.
– demodmap
Demapping of an analog signal to a digital signal.
– fmmod
Creates the FM modulation S of the message signal M with carrier fre-
quency FC.
– fmdemod
Creates the FM demodulation of the signal S sampled at frequency FS
with carrier frequency FC.
– genqammod
Modulates an information sequence of integers X in the range ’[0 ...’.
– genqamdemod
General quadrature amplitude demodulation.
– modmap
Mapping of a digital signal to an analog signal.

6
– pamdemod
Demodulates a pulse amplitude modulated signal X into an information
sequence of integers in the range ’[0 ...’.
– pammod
Modulates an information sequence of integers X in the range ’[0 ...’.

– pskdemod
Demodulates a complex-baseband phase shift keying modulated signal into
an information sequence of integers in the range ’[0 ...’.
– pskmod
Modulates an information sequence of integers X in the range ’[0 ...’.
– qaskdeco
Demaps an analog signal using a square QASK constellation.
– qaskenco
Maps a digital signal using a square QASK constellation.

– qammod
Create the QAM modulation of x with a size of alphabet m.
– qamdemod
Create the QAM demodulation of x with a size of alphabet m.

1.6 Channel Filters


– rcosfir
Implements a cosine filter or root cosine filter impulse response.

1.7 Galois Fields of Even Characteristic


– all
For a vector argument, return true (logical 1) if all elements of the vector
are nonzero.
– any
For a vector argument, return true (logical 1) if any element of the vector
is nonzero.

– cosets
Finds the elements of GF(2M ) with primitive polynomial PRIM, that
share the same minimum polynomial.
– conv
Convolve two vectors A and B.

7
– convmtx
If A is a column vector and X is a column vector of length N, then ...
– deconv
Deconvolve two vectors (polynomial division).
– det
Compute the determinant of A.
– dftmtx
Compute the N-by-N Fourier transformation matrix.
– diag
Return a diagonal matrix with vector V on diagonal K.
– exp
Compute ’ex ’ for each element of X.
– gf
Creates a Galois field array GF(2M ) from the matrix X.
– fft
Compute the discrete Fourier transform of X using a Fast Fourier Trans-
form (FFT) algorithm.
– filter
Apply a 1-D digital filter to the data X.
– gftable
This function exists for compatibility with MATLAB.
– gfweight
Calculate the minimum weight or distance of a linear block code.
– ifft
Compute the inverse discrete Fourier transform of X using a Fast Fourier
Transform (FFT) algorithm.
– inv
Compute the inverse of the square matrix A.
– inverse
Compute the inverse of the square matrix A.
– isequal
Return true if all of X1, X2, ... are equal.
– log
Compute the natural logarithm, ’ln (X)’, for each element of X.
– lu
Compute the LU decomposition of A.

8
– prod
Product of elements along dimension DIM.
– sqrt
Compute the square root of each element of X.

– rank
Compute the rank of matrix A, using the singular value decomposition.
– reshape
Return a matrix with the specified dimensions (M, N, ...) whose elements
are taken from the matrix A.

– roots
Compute the roots of the polynomial C.
– sum
Sum of elements along dimension DIM.

– sumsq
Sum of squares of elements along dimension DIM.
– isempty
Return true if A is an empty matrix (any one of its dimensions is zero).
– isgalois
Return 1 if the value of the expression EXPR is a Galois Field.
– isprimitive
Returns 1 if the polynomial represented by A is a primitive polynomial of
GF(2).

– length
Return the length of the object A.
– minpol
Finds the minimum polynomial for elements of a Galois Field.
– polyval
Evaluate the polynomial P at the specified values of X.
– primpoly
Finds the primitive polynomials in GF(2M ).
– size
Return a row vector with the size (number of elements) of each dimension
for the object A.

9
1.8 Utility Functions
– comms
Manual and test code for the Octave Communications toolbox.
– bi2de
Convert bit matrix to a vector of integers.
– de2bi
Convert a non-negative integer to bit vector.
– oct2dec
Convert octal to decimal values.
– istrellis
Return true if T is a valid trellis structure.
– poly2trellis
Convert convolutional code generator polynomials into trellis form.

– vec2mat
Converts the vector V into a C column matrix with row priority arrange-
ment and with the final column padded with the value D to the correct
length.

– qfunc
Compute the Q function.
– qfuncinv
Compute the inverse Q function.

1.9 Measurement and Analysis


– berconfint
Returns Bit Error Rate, BER, and confidence interval, INTERVAL, for
the number of errors R and number of transmitted bits N with a confidence
level of LEVEL.
– finddelay
Estimate the delay between times series X and time series Y by correlating
and finding the peak.

10
2 List out the command familiarised with the
help of examples
2.1 Adding Noise
Command: awgn
Description: Adds white Gaussian noise to a signal.
Example:
% Original signal
t = 0:0.01:1;
x = sin (2* pi *10* t ) ;

% Add white Gaussian noise with a signal - to - noise


ratio of 20 dB
y = awgn (x , 20 , ' measured ') ;

% Plot the original and noisy signals


figure ;
subplot (2 ,1 ,1) ;
plot (t , x ) ;
title ( ' Original Signal ') ;

subplot (2 ,1 ,2) ;
plot (t , y ) ;
title ( ' Noisy Signal ') ;

Figure 1: OUTPUT

11
2.2 Bit Error Rate
Command: biterr
Description: Compares two matrices and returns the number of bit errors and
the bit error rate.
Example:
% Original binary data
x = [0 1 0 1 1 0 0 1];

% Received binary data


y = [0 1 0 0 1 0 1 1];

% Calculate bit errors and bit error rate


[ numErrors , ber ] = biterr (x , y ) ;

fprintf ( ' Number of errors : % d \ n ' , numErrors ) ;


fprintf ( ' Bit error rate : % f \ n ' , ber ) ;

Figure 2: OUTPUT

12
2.3 Eye Diagram
Command: eyediagram
Description: Plots the eye diagram of a signal.
Example:
% Generate a random binary signal
data = randi ([0 1] , 1000 , 1) ;

% Modulate the signal using binary phase shift keying


( BPSK )
txSig = pskmod ( data , 2) ;

% Pass the signal through an AWGN channel


rxSig = awgn ( txSig , 15 , ' measured ') ;

% Plot the eye diagram


eyediagram ( rxSig , 2) ;
title ( ' Eye Diagram ') ;

Figure 3: OUTPUT

13
2.4 Random Bit Errors
Command: randerr
Description: Generates a matrix of random bit errors.
Example:
% Generate a random bit error pattern
[ errors , errorPositions ] = randerr (1 , 100 , 5) ;

% Original binary data


data = randi ([0 1] , 1 , 100) ;

% Introduce errors into the data


noisyData = data ;
noisyData ( errorPositions ) = ~ noisyData ( errorPositions )
;

fprintf ( ' Original Data :\ n ') ;


disp ( data ) ;

fprintf ( ' Noisy Data with Errors :\ n ') ;


disp ( noisyData ) ;

(a) Original Data:

(b) Noisy Data with Errors:

Figure 4: OUTPUT

14
2.5 Scatter Plot
Command: scatterplot
Description: Displays the scatter plot of a signal.
Example:
% Generate a random QPSK signal
data = randi ([0 3] , 1000 , 1) ;
txSig = pskmod ( data , 4) ;

% Pass the signal through an AWGN channel


rxSig = awgn ( txSig , 15 , ' measured ') ;

% Plot the scatter plot


scatterplot ( rxSig ) ;
title ( ' Scatter Plot of Received QPSK Signal ') ;

Figure 5: OUTPUT

15
2.6 White Gaussian Noise Matrix
Command: wgn
Description: Returns a matrix of white Gaussian noise.
Example:
% Generate a 5 x5 matrix of white Gaussian noise
noiseMatrix = wgn (5 , 5 , 0) ;

% Display the noise matrix


disp ( ' White Gaussian Noise Matrix : ') ;
disp ( noiseMatrix ) ;

Figure 6: OUTPUT

16
2.7 Binary Symmetric Channel
Command: bsc
Description: Sends data into a binary symmetric channel with a specified
probability of error.
Example:
% Original binary data
data = [1 0 1 1 0 1 0 0];

% Pass the data through a binary symmetric channel


with error probability 0.2
receivedData = bsc ( data , 0.2) ;

fprintf ( ' Original Data :\ n ') ;


disp ( data ) ;

fprintf ( ' Received Data with Errors :\ n ') ;


disp ( receivedData ) ;

Figure 7: OUTPUT

17

You might also like