Académique Documents
Professionnel Documents
Culture Documents
Apparatus:
Personal Computer
Matlab software
Theory:
In digital transmission, the number of bit errors is the number of received bits of a data
stream over a communication channel that have been altered due to noise, interference, distortion
or bit synchronization errors.
The bit error rate or bit error ratio (BER) is the number of bit errors divided by the total number
of transferred bits during a studied time interval. BER is a unitless performance measure, often
expressed as a percentage.
The bit error probability pe is the expectation value of the BER. The BER can be considered as
an approximate estimate of the bit error probability. This estimate is accurate for a long time
interval and a high number of bit errors.
As an example, assume this transmitted bit sequence:
0110001011
and the following received bit sequence:
0010101001
The number of bit errors (the underlined bits) is in this case 3. The BER is 3 incorrect bits
divided by 10 transferred bits, resulting in a BER of 0.3 or 30%.
Procedure:
Source Code:
clc;
clear all;
close all;
n=32;
k=15;
% Length of messages
dmin=6;
% Minimum distance
ebno=1:20;
ber_block=bercoding(ebno,'block','hard',n,k,dmin);
berfit(ebno,ber_block);
xlabel('ebno(db)');
% Reprsenting x axis
% Representing y axis
% Representing title
EXPERIMENT NO: 2
Verification of minimum distance of HAMMING Code
Name: Md Arif Ahmed
Roll NO: 12H66D7007
Date: 06/07/2013
Apparatus:
Personal Computer
Matlab software
Theory:
The number of corresponding bits that differ between two code words is the Hamming
distance of those two code words. For example, the Hamming distance between the code words
1001 and 0101 is 2. The Hamming distance of two code words can be calculated as the number
of 1 bits in the bitwise exclusive-or of the two code words: 1001 xor 0101 = 1100.
A code is the set of all code words of a given length that are constructed by adding a
specified number of check digits in a specified way to a specified number of data bits. The
minimum Hamming distance of a code is the minimum of the Hamming distance between all
possible pairs of code words of that code. The following table indicates the Hamming distance
between all pairs of a simple 4-bit binary code:
The Hamming distances between code words of a simple 4-bit code.
In the below example shown the minimum Hamming distance between any two code words is
2, the Hamming distance of the code is 2.
0000
0011
0101
0110
1001
1010
1100
1111
0000
0011
0101
0110
1001
1010
1100
1111
Procedure:
Source Code:
clc;
clear all;
close all;
m=3;
n=2^m-1;
k=4;
% Message length
code1=encode(msg,n,k,'hamming/binary');
code2=num2str(code1);
code=bin2dec(code2);
number1=[];
for i=1:8;
for j=i+1:8;
[number]=biterr(code(i),code(j),7);
% Compares code(i) & code(j) element
number1=[number1 number];
end
end
minidistance=min(number1)
EXPERIMENT NO: 3
Determination of output of Convolutional Encoder for a given sequence
Name: Md Arif Ahmed
Roll NO: 12H66D7007
Date: 20/07/2013
Theory:
Convolutional codes are used extensively in numerous applications in order to achieve
reliable data transfer, including digital video, radio, mobile communication, and satellite
communication. To convolutionally encode data, start with k memory registers, each holding 1
input bit. Unless otherwise specified, all memory registers start with a value of 0. The encoder
has n modulo-2 adders, and n generator polynomials one for each adder. An input bit m1 is
fed into the leftmost register. Using the generator polynomials and the existing values in the
remaining registers, the encoder outputs n bits. Now bit shift all register values to the right and
wait for the next input bit. If there are no remaining input bits, the encoder continues output until
all registers have returned to the zero state.
Procedure:
Source Code:
clc;
clear all;
close all;
% Providing Input
[n,k]=size(g)
lengths
m=k-1
% Number of registers
state=zeros(1,m)
b=zeros(1,m)
inputx=[input1,b]
% Zero Padding
[trash,h]=size(inputx)
outputy=[]
for x=1:h
input=inputx(1,x)
for i=1:n
output(i)=g(i,1)*input
for j=2:k
z=g(i,j)*state(j-1)
output(i)=xor(output(i),z)
end
end
state=[input,state(1:m-1)]
outputy=[outputy,output]
end
outputy
EXPERIMENT NO: 4
Determination of output of Convolutional Decoder for a given sequence
Name: Md Arif Ahmed
Roll NO: 12H66D7007
Date: 20/07/2013
Theory:
Several algorithms exist for decoding convolutional codes. For relatively small values of
k, the Viterbi algorithm is universally used as it provides maximum likelihood performance and
is highly parallelizable. Viterbi decoders are thus easy to implement in VLSI hardware and in
software on CPUs with SIMD instruction sets.
Longer constraint length codes are more practically decoded with any of several
sequential decoding algorithms, of which the Fano algorithm is the best known. Unlike Viterbi
decoding, sequential decoding is not maximum likelihood but its complexity increases only
slightly with constraint length, allowing the use of strong, long-constraint-length codes. Such
codes were used in the Pioneer program of the early 1970s to Jupiter and Saturn, but gave way to
shorter, Viterbi-decoded codes, usually concatenated with large Reed-Solomon error correction
codes that steepen the overall bit-error-rate curve and produce extremely low residual undetected
error rates. Both Viterbi and sequential decoding algorithms return hard decisions: the bits that
form the most likely codeword. An approximate confidence measure can be added to each bit by
use of the Soft output Viterbi algorithm.
Procedure:
1. Switch on the personal computer
2. Open matlab software
3. Open new editor m file
4. Write the program
5. Save it in the particular folder
6. Debug the program for verification
Source Code:
clc;
clear all;
close all;
tb=2;
% Length of positive integer scalar
t=poly2trellis([3],[7,5]);
polynomials encoded_sequence=[1 1 0 0 1 1]
decoded= vitdec(encoded_sequence,t,tb,'trunc','hard');
EXPERIMENT NO: 5
Direct sequence spread spectrum technique
Name: Md Arif Ahmed
Roll NO: 12H66D7007
Date: 03/08/2013
Theory:
Direct-sequence spread spectrum has been adopted for many current and future
communication systems, and it is also used widely for military communication networks and
systems. One of the motivations for employing direct-sequence spread spectrum is its ability to
combat fading due to multipath propagation.
Different spread-spectrum techniques are available, but all have one idea in common: the
key (also called the code or sequence) attached to the communication channel. The manner of
inserting this code defines precisely the spread-spectrum technique. The term "spread spectrum"
refers to the expansion of signal bandwidth. The formal definition of spread spectrum is more
precise: an RF communications system in which the baseband signal bandwidth is intentionally
spread over a larger bandwidth by injecting a higher frequency signal (Figure 1). As a direct
consequence, energy used in transmitting the signal is spread over a wider bandwidth, and
appears as noise. The ratio (in dB) between the spread baseband and the original signal is called
processing gain. Typical spread-spectrum processing gains run from 10dB to 60dB.To apply a
spread-spectrum technique, simply inject the corresponding spread-spectrum code somewhere in
the transmitting chain before the antenna (receiver). (That injection is called the spreading
operation.) The effect is to diffuse the information in a larger bandwidth. Conversely, you can
remove the spread-spectrum code (called a despreading operation) at a point in the receive chain
before data retrieval. A despreading operation reconstitutes the information into its original
bandwidth. Obviously, the same code must be known in advance at both ends of the transmission
channel. (In some circumstances, the code should be known only by those two parties.)
Procedure:
Source Code:
clc;
clear all;
close all;
b=round(rand(1,20));
pattern=[];
for k=1:20
if b(1,k)==0
sig=zeros(1,6)
else
sig=ones(1,6)
end
pattern=[pattern sig];
end
plot(pattern);
axis([-1 130 -0.5 1.5]);
title('\bit\if original bit sequence');
spread_sig=round(rand(1,120));
figure,
plot(spread_sig);
hopped_sig=xor(pattern,spread_sig);
dsss_sig=[];
t=[0:100];
fc=0.1;
c1=cos(2*pi*fc);
c2=cos(2*pi*fc*t+pi);
for k=1:120
if hopped_sig(1,k)==0;
dsss_sig=[dsss_sig c1]
else
dsss_sig=[dsss_sig c2]
end
end
figure,
plot(dsss_sig);
axis([-1 212 -1.5 1.5]);
figure,
plot(abs(fft(dsss_sig)));
EXPERIMENT NO: 6
Verification of DFT and IDFT on RGB image
Name: Md Arif Ahmed
Roll NO: 12H66D7007
Date: 17/08/2013
Apparatus:
Personal Computer
Matlab software
Theory:
and
with support
as follows.
Procedure:
Source Code:
clc;
clear all;
close all;
img =imread('water.jpg');
subplot(2,2,1);
imshow(img);
title('RGB IMAGE');
i=rgb2gray(img);
subplot(2,2,2);
imshow(i);
title('gray image');
j=fft2(i);
subplot(2,2,3);
imshow(j);
k=ifft2(j);
subplot(2,2,4);
imshow(k, [0 255]);
Result: DFT and IDFT operations are performed on RGB image and verified
EXPERIMENT NO: 7
Verification of DCT AND IDCT on RGB image
Name: Md Arif Ahmed
Roll NO: 12H66D7007
Date: 24/08/2013
Apparatus:
Personal Computer
Matlab software
Theory:
The discrete cosine transform (DCT) is used to transform a signal from the spatial
domain into the frequency domain. The reverse process, that of transforming a signal from the
frequency domain into the spatial domain, is called the inverse discrete cosine transform (IDCT).
A signal in the frequency domain contains the same information as that in the spatial domain.
The order of values obtained by applying the DCT is coincidentally from lowest to highest
frequency.
This feature and the psychological observation that the human eye and ear are less sensitive to
recognizing the higher-order frequencies leads to the possibility of compressing a spatial signal
by transforming it to the frequency domain and dropping high-order values and keeping loworder ones. When reconstructing the signal, and transforming it back to the spatial domain, the
results are remarkably similar to the original signal.
This process, with a few extra bells and whistles and slightly modified versions of DCT, is the
essence behind jpeg, mpeg, and mp3 compression.
Here, we look at a simplified case of compression using the DCT and IDCT without bells and
whistles. The process:
Procedure:
Source Code:
clc;
clear all;
close all;
RGB = imread('rose2.jpg');
subplot(4,3,1);
imshow(RGB);
title('RGB Image');
I = rgb2gray(RGB);
subplot(4,3,2);
imshow(I);
title('GRAY image');
J = dct2(I);
subplot(4,3,3);
K = idct2(J);
subplot(4,3,4);
imshow(K,[0 255]);
title('IDCT image');
IR=dct2(RGB(:,:,1));
subplot(4,3,5);
imshow(IR);
IG=dct2(RGB(:,:,2));
subplot(4,3,6);
imshow(IG);
IB=dct2(RGB(:,:,3));
subplot(4,3,7 );
imshow(IB);
RI=idct2(IR);
subplot(4,3,8);
imshow(RI,[0,255]);
GI=idct2(IG);
subplot(4,3,9);
imshow(GI,[0,255]);
BI=idct2(IB);
subplot(4,3,10);
imshow(BI,[0,255]);
RGBO(:,:,1)=RI
RGBO(:,:,2)=GI
RGBO(:,:,3)=BI
subplot(4,3,11);
imshow(uint8(RGBO));
Result: DCT and IDCT operations are performed on RGB image and verified
EXPERIMENT NO: 8
Verification of DFT, DCT, IDFT & IDCT on RGB image
Name: Md Arif Ahmed
Roll NO: 12H66D7007
Date: 31/08/2013
Apparatus:
Personal Computer
Matlab software
Theory:
The discrete Fourier transform (DFT) is a fundamental transform in digital signal
processing, with applications in frequency analysis, fast convolution, image processing, etc.
Moreover, fast algorithms exist that make it possible to compute the DFT very efficiently. In
image processing, the samples can be the values of pixels along a row or column of a raster
image.
The discrete Fourier transform (DFT) is "the Fourier transform for finite-length
sequences" because, unlike the (discrete-space) Fourier transform, the DFT has a discrete
argument and can be stored in a finite number of infinite word-length locations. Yet, it turns out
that the DFT can be used to exactly implement convolution for finite-size arrays. Our approach
to the DFT will be through the discrete Fourier series DFS, which is made possible by the
isomorphism between rectangular periodic and finite-length, rectangular-support sequences.
Definition (discrete Fourier transform)
and
with support
as follows.
The discrete cosine transform (DCT) is used to transform a signal from the spatial
domain into the frequency domain. The reverse process, that of transforming a signal from the
frequency domain into the spatial domain, is called the inverse discrete cosine transform (IDCT).
A signal in the frequency domain contains the same information as that in the spatial domain.
The order of values obtained by applying the DCT is coincidentally from lowest to highest
frequency. This feature and the psychological observation that the human eye and ear are less
sensitive to recognizing the higher-order frequencies leads to the possibility of compressing a
spatial signal by transforming it to the frequency domain and dropping high-order values and
keeping low-order ones. When reconstructing the signal, and transforming it back to the spatial
domain, the results are remarkably similar to the original signal.
Procedure:
Source Code:
clc;
clear all;
close all;
pic=imread('petdog.jpg');
subplot(3,3,1);
imshow(pic);
title('RGB Image');
i=rgb2gray(pic);
subplot(3,3,2);
imshow(i);
title('GRAY image');
j=fft2(i);
subplot(3,3,3);
imshow(j);
title('DFT of the gray image');
k=dct2(j);
subplot(3,3,4);
l=idct2(k);
subplot(3,3,5);
imshow(l,[0 255]);
m=ifft2(l);
subplot(3,3,6);
imshow(m,[0 255]);
Result: DFT, DCT, IDCT and IDFT operations are performed and verified for an RGB image
EXPERIMENT NO: 9
Edge, Line and Point Detection Techniques
Name: Md Arif Ahmed
Roll NO: 12H66D7007
Date: 21/09/2013
Aim: To study Edge, Line and Point Detection Techniques using Derivative Operators.
Apparatus:
Personal Computer
Matlab software
Theory:
The three basic types of gray level discontinuities in a digital image are: points, lines
and edges.
Point detection
The detection of the point is straightforward in principle. Using the mask(laplacian mask)
shown below we can say a point is detected at the location, on which the mask is centered,if |R|
>= T where T is a nonnegative threshold value. The idea is that an isolated point(a point whose
gray level is significantly different from its background) will be quite different from the
surroundings and can be easily detectable with this type of mask. The mask response R will be
zero at areas of constant gray level.
-1 -1 -1
-1 8
-1
-1 -1 -1
Line Detection
The next level of complexity is the Line detection.Consider the masks shown below.
If the given mask were moved around an image,it will respond to lines which are oriented
horizontally.With a constant background ,the maximum response would result when the line
passed through the middle row of the mask.
-1 -1 -1
2
-1 -1 -1
A similar mask as shown below, responds best to the lines oriented at +45 degrees.This is easily
verified by sketching a simple array of 1's with a line of different gray level(say 5's) running
diagonally through the array.
-1 -1 2
-1 2
2
-1
-1 -1
The lines which are oriented vertically, respond best to the mask given below.
-1 2 -1
-1 2 -1
-1 2 -1
Edge Detection
Althoughpoint and line detection are important,edge detection is the most common
approach for detecting meaningful disocontinuities in gray level. In this section ,we discuss
approaches for implementing first- and second- order level derivatives for the detection of edges
in the image.Edge detection is complicated with false edges created by image noise. The number
of false edges can be lowered by using image noise reduction techniques before detecting edges.
Procedure:
clc;
clear all;
close all;
i=imread('cameraman.tif');
subplot(3,2,1);
imshow(i);
title('original mage');
j=edge(i,'sobel');
subplot(3,2,2);
imshow(j);
k=edge(i,'prewitt');
subplot(3,2,3);
imshow(k);
l=edge(i,'robert');
subplot(3,2,4);
imshow(l);
h=edge(i,'log');
subplot(3,2,5);
imshow(h);
clear all;
close all;
f=imread('cameraman.tif');
subplot(2,2,1);
imshow(f);
title('original mage');
g=edge(f,'horizontal');
h=edge(f,'vertical');
subplot(2,2,2);
imshow(g);
subplot(2,2,3);
imshow(h);
k=g+h;
subplot(2,2,4);
imshow(k);
clc;
clear all;
close all;
i=imread('swan.jpg');
H=[1 1 1;1 -8 1;1 1 1];
b=imfilter(i,H);
subplot(1,2,1);
imshow(i);
title('original image');
subplot(1,2,2);
imshow(b);
title('point detection');
Result: EDGE, LINE and POINT Detection techniques using different operators are verified.
1. Open Code Composer Studio and select C6713 Simulator click save and quit.
2. Start a new project using project/new .
3. Pull down menu, save it in a separate directory (c:/my project) with file name (sine
wave.pjt).
4. Create a new source file using File/New/Source file menu and save it in folder ( in c)
5. Add the source file (sine wave.c) to the project.
6. Now go to Project menu click on add files to the project and select the File name
(sinewave.c)
7. Pull down menu and click on project and click on add files to the project now add the
Linker Command file Hello.cmd (Path:c:/cc studio/tutorial/dsk6713/hello/hello.cmd).
8. Add the run time support library file RTS6700.lib again go to project and click on add
files to project (Path:c/cc studio/cg tools/lib/rts6700.lib)
9. Complete the program using project compile pull down main menu or by ctrl+f7.
10. Build the program using project build pull down menu.
11. Load the program in the program memory of DSP kit using the file load program using
the pull down menu and now load Sinewave.out file.
12. Run the program using Debug pull down menu or run F5.
13. To View output Graphically select view/graph/time and frequency
EXPERIMENT NO: 10
Generation of Sine wave and Square wave using TMS320C6713 DSK
Aim: To generate sine wave and Square wave using TMS320C6713 DSK ( DSP Starter Kit).
Apparatus:
1. TMS320C6713 DSK
2. Personal Computer
3. Code Composer Studio Software
Theory:
The sine wave or sinusoid is a mathematical curve that describes a smooth repetitive
oscillation. It is named after the function sine, of which it is the graph. It occurs often in pure and
applied mathematics, as well as physics, engineering, signal processing and many other fields. Its
most basic form as a function of time (t) is:
where:
f, the ordinary frequency, is the number of oscillations (cycles) that occur each second of
time.
= 2f, the angular frequency, is the rate of change of the function argument in units of
radians per second
, the phase, specifies (in radians) where in its cycle the oscillation is at t = 0.
When is non-zero, the entire waveform appears to be shifted in time by the amount /
seconds. A negative value represents a delay, and a positive value represents an advance.
A square wave is a non-sinusoidal periodic waveform (which can be represented as an
infinite summation of sinusoidal waves), in which the amplitude alternates at a steady frequency
between fixed minimum and maximum values, with the same duration at minimum and
maximum. The transition between minimum to maximum is instantaneous for an ideal square
wave; this is not realisable in physical systems. Square waves are often encountered in
electronics and signal processing.
#include<stdio.h>
#include<math.h>
float a[500];
void main()
{
int i=0;
for(i=0;i<500;i++)
{
a[i]=sin (2*3.14*2000*i);
}
}
Result: Sine wave and Sqaure wave are generated using TMS320C6713 DSK.
EXPERIMENT NO: 11
Generation of FIR Filter using TMS320C6713 DSK
Aim: To generate FIR Filter using TMS320C6713 DSK ( DSP Starter Kit).
Apparatus:
1. TMS320C6713 DSK
2. Personal Computer
3. Code Composer Studio Software
Theory:
In signal processing, a finite impulse response (FIR) filter is a filter whose impulse
response (or response to any finite length input) is of finite duration, because it settles to zero in
finite time. This is in contrast to infinite impulse response (IIR) filters, which may have internal
feedback and may continue to respond indefinitely (usually decaying). The impulse response of
an Nth-order discrete-time FIR filter lasts for N + 1 samples, and then settles to zero. FIR filters
can be discrete-time or continuous-time, and digital or analog. The output y of a linear time
invariant system is determined by convolving its input signal x with its impulse response b.
For a discrete-time FIR filter, the output is a weighted sum of the current and a finite
number of previous values of the input. The operation is described by the following equation,
which defines the output sequence y[n] in terms of its input sequence x[n]:
where :
are the filter coefficients, also known as tap weights, that make up the impulse
response,
Source code:
#include<stdio.h>
#include<math.h>
# define pi3.1415
int n,N,c;
float wr[64],wt[64];
void main()
{
printf("\n enter no of samples N=;");
scanf("%d",&N);
printf("\n enter choice of window function \n 1.rect\n 2.triang\n c=:");
scanf("%d",&c);
printf("\n elements of window function are:");
switch(c)
{
case 1:
for(n=0;n<=N-1;n++)
{
wr[n]=1;
printf("\n wr[%d]=%f",n,wr[n]);
}
break;
case 2:
for(n=0;n<=N-1;n++)
{
wt[n]=1-(2*(float)n/(N-1));
printf("\n wt(%d)=%f",n,wt[n]);
}
break;
}
}
Result Analysis:
When the bit-error-rate is high, many bits will be in error. The worst-case bit-error-rate is
4%percent, at which point, the modem is essentially useless. Most communications systems
require bit-error-rates several orders of magnitude lower than this.
Even a bit-error-rate of one percent is considered quite high. We usually want to plot a
curve of the bit-error-rate as a function of the SNR, and include enough points to cover a wide
range of bit-error-rates. At high SNRs, this can become difficult, since the bit-error-rate becomes
very low. For example, a bit-error-rate of 10^6 means only one bit out of every million bits will
be in error.
In our test signal only contains 1000bits, we will most likely not see an error at this biterror-rate. In order to be statistically significant, each simulation we run must generate some
number of errors. If a simulation generates no errors, I t does not mean the bit-error-rate is zero;
it only means we did not have enough b its in our transmitted signal. As a rule of thumb, we need
about 100 (or more) errors in each simulation, in order to have confidence that our bit-error-rate
is statistically valid. At high SNRs, this can require a test signal containing millions, or even
billions of bits.
Result Analysis:
Hamming codes have a minimum distance of 3, which means that the decoder can detect
and correct a single error, but it cannot distinguish a double bit error of some codeword from a
single bit error of a different codeword. Thus, they can detect double-bit errors only if correction
is not attempted.
Result Analysis:
K = number of bits shifted into the encoder at one time
K =2 is used here
N = number of encoder output bits corresponding to the K information bits
r=k /n= code rate
K= constraint length, encoder memory
Each encoded bit is a function of the present input bits and their past ones.
The operation of a convolutional encoder can be represented using state diagrams and trellis
diagrams. State diagrams give a compact representation of the encoding process, but hide the
evolution of the encoding process over time. Trellis diagrams give that extra dimension.
Result Analysis:
Consider a polynomial of a length of positive integers scalar that defines a track depth
convert the convolution code polynomial code into trellis description and decode to convolution
data using veterbi decoder.
Here i had considered the same encoder inputs for which the output obtained is using
viterbi decoding algorithm.
Output:
Minimum distance of hamming code is 2