experimentno-131231022848-phpapp01

Upload: vivek-sinha

Post on 02-Jun-2018

224 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/10/2019 experimentno-131231022848-phpapp01

    1/42

    EXPERIMENT NO: 1

    Measurement of BIT ERROR RATE (BER) using binary data

    Name: Md Arif AhmedRoll NO: 12H66D7007

    Date: 06/07/2013

    Aim:To measure BER of binary data

    Apparatus:

    Personal Computer

    Matlab software

    Theory:

    Indigital transmission,the number of bit errors is the number of receivedbits of adata

    stream over acommunication channel that have been altered due tonoise,interference,distortion

    orbit 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 apercentage.

    The bit error probability peis theexpectation 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:

    0 1 1 0 0 0 1 0 1 1

    and the following received bit sequence:

    0 0 1 0 1 0 1 0 0 1

    http://en.wikipedia.org/wiki/Digital_transmissionhttp://en.wikipedia.org/wiki/Bithttp://en.wikipedia.org/wiki/Data_streamhttp://en.wikipedia.org/wiki/Data_streamhttp://en.wikipedia.org/wiki/Communication_channelhttp://en.wikipedia.org/wiki/Noise_%28telecommunications%29http://en.wikipedia.org/wiki/Interference_%28communication%29http://en.wikipedia.org/wiki/Distortionhttp://en.wikipedia.org/wiki/Bit_synchronizationhttp://en.wikipedia.org/wiki/Percentagehttp://en.wikipedia.org/wiki/Expectation_valuehttp://en.wikipedia.org/wiki/Expectation_valuehttp://en.wikipedia.org/wiki/Percentagehttp://en.wikipedia.org/wiki/Bit_synchronizationhttp://en.wikipedia.org/wiki/Distortionhttp://en.wikipedia.org/wiki/Interference_%28communication%29http://en.wikipedia.org/wiki/Noise_%28telecommunications%29http://en.wikipedia.org/wiki/Communication_channelhttp://en.wikipedia.org/wiki/Data_streamhttp://en.wikipedia.org/wiki/Data_streamhttp://en.wikipedia.org/wiki/Bithttp://en.wikipedia.org/wiki/Digital_transmission
  • 8/10/2019 experimentno-131231022848-phpapp01

    2/42

  • 8/10/2019 experimentno-131231022848-phpapp01

    3/42

    EXPERIMENT NO: 2

    Verification of minimum distance of HAMMING Code

    Name: Md Arif AhmedRoll NO: 12H66D7007

    Date: 06/07/2013

    Aim:To find the minimum distance of Hamming code

    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.

  • 8/10/2019 experimentno-131231022848-phpapp01

    4/42

    0000 0011 0101 0110 1001 1010 1100 1111

    0000 - 2 2 2 2 2 2 4

    0011 2 - 2 2 2 2 4 2

    0101 2 2 - 2 2 4 2 2

    0110 2 2 2 - 4 2 2 2

    1001 2 2 2 4 - 2 2 2

    1010 2 2 4 2 2 - 2 2

    1100 2 4 2 2 2 2 - 2

    1111 4 2 2 2 2 2 2 -

    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; % Clears the command window

    clear all; % Clears the work space

    close all; % Clears the figure windowm=3;

    n=2^m-1; % Code word length

    k=4; % Message length

    msg=[0 0 0 0; 0 0 0 1; 0 0 1 0;0 0 1 1;0 1 0 0;0 1 0 1;0 1 1 0;0 1 1 1];

  • 8/10/2019 experimentno-131231022848-phpapp01

    5/42

  • 8/10/2019 experimentno-131231022848-phpapp01

    6/42

  • 8/10/2019 experimentno-131231022848-phpapp01

    7/42

    Source Code:

    clc; % Clears the command window

    clear all; % Clears the workspace

    close all; % Clears the figure window

    g=input('enter the generator polynomial coefficient') ; % Providing Input

    [n,k]=size(g) % Calculates n and constrained

    lengths

    m=k-1 % Number of registers

    state=zeros(1,m) % Set registers to zero

    input1=input('enter the message bits') % Input the message bits

    b=zeros(1,m) % Generate row matrix of length 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] % New element added to sequence

    end

    outputy % Final encoder output

    Result:Output of convolutional encoder is determined for a given sequence

  • 8/10/2019 experimentno-131231022848-phpapp01

    8/42

    EXPERIMENT NO: 4

    Determination of output of Convolutional Decoder for a given sequence

    Name: Md Arif Ahmed

    Roll NO: 12H66D7007

    Date: 20/07/2013

    Aim: To determine output of convolutional Decoder for a given sequence

    Apparatus:

    Personal Computer

    Matlab software

    Theory:

    Severalalgorithms exist for decoding convolutional codes. For relatively small values of

    k, theViterbi algorithm is universally used as it providesmaximum likelihoodperformance and

    is highly parallelizable. Viterbi decoders are thus easy to implement in VLSI hardware and in

    software on CPUs withSIMD instruction sets.

    Longer constraint length codes are more practically decoded with any of several

    sequential decoding algorithms, of which theFano 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 thePioneer program of the early 1970s to Jupiter and Saturn, but gave way to

    shorter, Viterbi-decoded codes, usually concatenated with largeReed-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 theSoft output Viterbi algorithm.

    http://en.wikipedia.org/wiki/Algorithmhttp://en.wikipedia.org/wiki/Viterbi_algorithmhttp://en.wikipedia.org/wiki/Maximum_likelihoodhttp://en.wikipedia.org/wiki/VLSIhttp://en.wikipedia.org/wiki/SIMDhttp://en.wikipedia.org/wiki/Sequential_decodinghttp://en.wikipedia.org/wiki/Robert_Fanohttp://en.wikipedia.org/wiki/Pioneer_programhttp://en.wikipedia.org/wiki/Reed-Solomon_error_correctionhttp://en.wikipedia.org/wiki/Soft_output_Viterbi_algorithmhttp://en.wikipedia.org/wiki/Soft_output_Viterbi_algorithmhttp://en.wikipedia.org/wiki/Reed-Solomon_error_correctionhttp://en.wikipedia.org/wiki/Pioneer_programhttp://en.wikipedia.org/wiki/Robert_Fanohttp://en.wikipedia.org/wiki/Sequential_decodinghttp://en.wikipedia.org/wiki/SIMDhttp://en.wikipedia.org/wiki/VLSIhttp://en.wikipedia.org/wiki/Maximum_likelihoodhttp://en.wikipedia.org/wiki/Viterbi_algorithmhttp://en.wikipedia.org/wiki/Algorithm
  • 8/10/2019 experimentno-131231022848-phpapp01

    9/42

    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; % Clears the command windowclear all; % Clears the workspace

    close all; % Clears the figure window

    tb=2;

    % Length of positive integer scalar

    t=poly2trellis([3],[7,5]); % Converting the convolution code

    polynomials encoded_sequence=[1 1 0 0 1 1]

    decoded= vitdec(encoded_sequence,t,tb,'trunc','hard'); % Decoding using Viterbi Algorithm

    Result:The output of convolutional decoder is determined for a given sequence.

  • 8/10/2019 experimentno-131231022848-phpapp01

    10/42

    EXPERIMENT NO: 5

    Direct sequence spread spectrum technique

    Name: Md Arif AhmedRoll NO: 12H66D7007

    Date: 03/08/2013

    Aim: To verify Direct sequence spread spectrum technique

    Apparatus:

    Personal Computer

    Matlab software

    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 ofspread 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

    http://www.maximintegrated.com/glossary/definitions.mvp/term/Spread-Spectrum/gpk/293http://www.maximintegrated.com/glossary/definitions.mvp/term/Spread-Spectrum/gpk/293
  • 8/10/2019 experimentno-131231022848-phpapp01

    11/42

    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:

    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; % Clears the command window

    clear all; % Clears the workspaceclose all; % Clears the figure window

    % Generating the bit pattern with each bit 6 samples long

  • 8/10/2019 experimentno-131231022848-phpapp01

    12/42

    b=round(rand(1,20)); % Round the nearest uniformly

    %distributed pseudo random numbers

    pattern=[]; % Construct pattern generator object

    for k=1:20

    if b(1,k)==0

    sig=zeros(1,6) % Create array of all zeros

    else

    sig=ones(1,6) % Creates array of all ones

    end

    pattern=[pattern sig];

    end

    plot(pattern);

    axis([-1 130 -0.5 1.5]);

    title('\bit\if original bit sequence');

    % Generating the pseudorandom bit pattern for spreading

    spread_sig=round(rand(1,120)); % Round the nearest uniformly

    %distributed pseudorandom numbers

    figure,

    plot(spread_sig); % Plot spread signal

    axis([-1 130 -0.5 1.5]);

    title('\bit\if pseudorandom bit sequence');

    % Add title to current axis

    % XOR ing the pattern with spread signal

    hopped_sig=xor(pattern,spread_sig); % Perform the logical exclusive or

    %operation

    % Modulating the Hopped signal

  • 8/10/2019 experimentno-131231022848-phpapp01

    13/42

    dsss_sig=[];

    t=[0:100];

    fc=0.1;

    c1=cos(2*pi*fc); % Creates the cosine signal1

    c2=cos(2*pi*fc*t+pi); % Creates the cosine signal2

    for k=1:120

    if hopped_sig(1,k)==0; % If the hopped signal is zero then

    %perform the signal1

    dsss_sig=[dsss_sig c1]

    else

    dsss_sig=[dsss_sig c2] % If the hopped signal is zero then

    %perform the signal2

    end

    end

    figure,

    plot(dsss_sig);

    axis([-1 212 -1.5 1.5]);

    figure,

    plot(abs(fft(dsss_sig))); % Plotting the fft of dsss signal

    title('absolute value of dsss'); % Plots absolute value if the discrete

    % sequence spread spectrum signal

    Result: Direct Sequence Spread Spectrum Technique is Verified

  • 8/10/2019 experimentno-131231022848-phpapp01

    14/42

  • 8/10/2019 experimentno-131231022848-phpapp01

    15/42

    For a finite-support sequence with support , we define its DFT

    for integers and as follows.

    The inverse DFT (IDFT) exists and is given by

    Procedure:

    1. Switch on the personal computer

    2. Open mat lab 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; % Clears the command window

    clear all; % Clears the workspace

    close all; % Clears the figure window

    img =imread('water.jpg'); % Reading image from a file

  • 8/10/2019 experimentno-131231022848-phpapp01

    16/42

    subplot(2,2,1); % Create and control multiple axis

    imshow(img); % Displays rgb image

    title('RGB IMAGE'); % Displays title of the image

    i=rgb2gray(img); % Converts RGB image into Gray image

    subplot(2,2,2); % Create and control multiple axis

    imshow(i); % Displays gray image of RGB

    title('gray image'); % Displays title of the image

    j=fft2(i); % Perform DFT operation on gray image

    subplot(2,2,3); % Create and control multiple axis

    imshow(j); % Displays fft of gray

    title('fft of gray image'); % Displays title of the image

    k=ifft2(j); % Perform IDFT operation on gray

    % image

    subplot(2,2,4); % Create and control multiple axis

    imshow(k, [0 255]); % Displays IDFT image

    title('idft of gray image'); % Displays title of the image

    Result: DFT and IDFT operations are performed on RGB image and verified

  • 8/10/2019 experimentno-131231022848-phpapp01

    17/42

  • 8/10/2019 experimentno-131231022848-phpapp01

    18/42

    Here, we look at a simplified case of compression using the DCT and IDCT without bells and

    whistles. The process:

    X = Apply DCT to a sequence of values.

    X' = Drop a portion of high-order values from X.

    X'' = Apply IDCT to X'

    Draw X'' and observe the similarity to the original X.

    Procedure:

    1. Switch on the personal computer

    2. Open mat lab 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; % Clears the command window

    clear all; % Clears the workspace

    close all; % Clears the figure window

    RGB = imread('rose2.jpg'); % Reading image from a file

    subplot(4,3,1); % Create and control multiple axis

    imshow(RGB); % Displays RGB image

    title('RGB Image'); % Displays title of the image

    I = rgb2gray(RGB); % Converts RGB image into Gray image

    subplot(4,3,2); % Create and control multiple axis

    imshow(I); % Displays gray image

    title('GRAY image'); % Displays title of the image

    J = dct2(I); % Perform DCT operation on gray image

    subplot(4,3,3); % Create and control multiple axis

  • 8/10/2019 experimentno-131231022848-phpapp01

    19/42

  • 8/10/2019 experimentno-131231022848-phpapp01

    20/42

    RGBO(:,:,1)=RI

    RGBO(:,:,2)=GI

    RGBO(:,:,3)=BI

    subplot(4,3,11); % Create and control multiple axis

    imshow(uint8(RGBO)); % Combining and reconstructing

    title('Reconstrcuted original image from R,G,B'); % Displays title of the image

    Result:DCT and IDCT operations are performed on RGB image and verified

  • 8/10/2019 experimentno-131231022848-phpapp01

    21/42

    EXPERIMENT NO: 8

    Verification of DFT, DCT, IDFT & IDCT on RGB image

    Name: Md Arif AhmedRoll NO: 12H66D7007

    Date:31/08/2013

    Aim:To verify DFT, DCT, IDFT and IDCT on RGB image

    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. Inimage 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)

    http://en.wikipedia.org/wiki/Image_processinghttp://en.wikipedia.org/wiki/Pixelhttp://en.wikipedia.org/wiki/Raster_imagehttp://en.wikipedia.org/wiki/Raster_imagehttp://en.wikipedia.org/wiki/Raster_imagehttp://en.wikipedia.org/wiki/Raster_imagehttp://en.wikipedia.org/wiki/Pixelhttp://en.wikipedia.org/wiki/Image_processing
  • 8/10/2019 experimentno-131231022848-phpapp01

    22/42

    For a finite-support sequence with support , we define its DFT

    for integers and as follows.

    The inverse DFT (IDFT) exists and is given by

    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:

    1. Switch on the personal computer

    2. Open mat lab software

  • 8/10/2019 experimentno-131231022848-phpapp01

    23/42

    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; % Clears the command window

    clear all; % Clears the workspace

    close all; % Clears the figure window

    pic=imread('petdog.jpg'); % Reading image from a file

    subplot(3,3,1); % Create and control multiple axis

    imshow(pic); % Displays RGB image

    title('RGB Image'); % Displays title of the image

    i=rgb2gray(pic); % Converts RGB image into Gray image

    subplot(3,3,2); % Create and control multiple axis

    imshow(i); % Displays gray image

    title('GRAY image'); % Displays title of the image

    j=fft2(i); % Perform DFT operation on gray image

    subplot(3,3,3); % Create and control multiple axis

    imshow(j);

    title('DFT of the gray image'); % Displays title of the image

    k=dct2(j); % Perform DCT operation on gray image

    subplot(3,3,4); % Create and control multiple axis

    imshow(log(abs(k)),[]), colormap(jet(64)), colorbar

    k(abs(k) < 10) = 0;

    title('DCT of the dft image'); % Displays title of the image

    l=idct2(k); % Performs IDCT operation

    subplot(3,3,5); % Create and control multiple axis

    imshow(l,[0 255]); % Displays IDCT of gray image

    title('IDCT of the DCT image'); % Displays title of the image

  • 8/10/2019 experimentno-131231022848-phpapp01

    24/42

    m=ifft2(l); % Perform IDFT operation on gray image

    subplot(3,3,6); % Create and control multiple axis

    imshow(m,[0 255]); % Displays IDFT image

    title('idft of idct image'); % Displays title of the image

    Result:DFT, DCT, IDCT and IDFT operations are performed and verified for an RGB image

  • 8/10/2019 experimentno-131231022848-phpapp01

    25/42

    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 graylevel 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

  • 8/10/2019 experimentno-131231022848-phpapp01

    26/42

    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 2 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 -1

    2 -1 -1

    The lines which are oriented vertically, respond best to the mask given below.

    -1 2 -1

    -1 2 -1

    -1 2 -1

  • 8/10/2019 experimentno-131231022848-phpapp01

    27/42

    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 edgesin 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:

    1. Switch on the personal computer

    2. Open mat lab 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 for Edge Detection:

    clc; % Clears the command window

    clear all; % Clears the workspace

    close all; % Clears the figure window

    i=imread('cameraman.tif'); % Reads image from a file

    subplot(3,2,1); % Create and control multiple axis

    imshow(i); % Displays original image

    title('original mage'); % Representing title of the image

    j=edge(i,'sobel'); % Finding sobel edge detection in gray scale image

    subplot(3,2,2); % Create and control multiple axis

    imshow(j); % Displays sobel image

    title('sobel edge detection'); % Representing title of the image

    k=edge(i,'prewitt'); % Finding prewitt edge detection in gray scale image

  • 8/10/2019 experimentno-131231022848-phpapp01

    28/42

    subplot(3,2,3); % Create and control multiple axis

    imshow(k); % Displays prewitt image

    title('prewitt edge detection'); % Representing title of the image

    l=edge(i,'robert'); % Finding robert edge detection in gray scale image

    subplot(3,2,4); % Create and control multiple axis

    imshow(l); % Displays robert image

    title('robert edge detction'); % Representing title of the image

    h=edge(i,'log'); % Finding logarithmic edge detection in gray scale image

    subplot(3,2,5); % Create and control multiple axis

    imshow(h); % Displays logarithmic image

    title('log edge detection'); % Representing title of the image

  • 8/10/2019 experimentno-131231022848-phpapp01

    29/42

    Source Code For Line Detection:

    clc; % Clears the command window

    clear all; % Clears the workspace

    close all; % Clears the figure window

    f=imread('cameraman.tif'); % Reads image from a file

    subplot(2,2,1); % Create and control multiple axis

    imshow(f); % Displays original image

    title('original mage'); % Representing title of the image

    g=edge(f,'horizontal'); % Finding horizontal edges in gray image

    h=edge(f,'vertical'); % Finding vertical edges in gray image

    subplot(2,2,2); % Create and control multiple axis

    imshow(g); % Displays horizontal edge image

    title('horizontal gradient componenet'); % Representing title of the image

    subplot(2,2,3); % Create and control multiple axis

    imshow(h); % Displays vertical edge image

    title('vertical gradient component'); % Representing title of the image

    k=g+h; % Combining horizontal and vertical edge images

    subplot(2,2,4); % Create and control multiple axis

    imshow(k); % Displays combined image

    title('combining the edges'); % Representing title of the image

  • 8/10/2019 experimentno-131231022848-phpapp01

    30/42

    Source Code for Point Detection:

    clc; % Clears the command window

    clear all; % Clears the workspace

    close all; % Clears the figure window

    i=imread('swan.jpg');

    H=[1 1 1;1 -8 1;1 1 1];

    b=imfilter(i,H); % N-D filtering in multidimensional image

    subplot(1,2,1); % Create and control multiple axis

    imshow(i); % Diaplays original image

    title('original image'); % Represnting title of the image

    subplot(1,2,2); % Create and control multiplea axis

    imshow(b); % Displays filtered image

    title('point detection'); % Representing title of the image

    Result: EDGE, LINE and POINT Detection techniques using different operators are verified.

  • 8/10/2019 experimentno-131231022848-phpapp01

    31/42

    Procedure for writing Programs using DSP Kit

    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

  • 8/10/2019 experimentno-131231022848-phpapp01

    32/42

    EXPERIMENT NO: 10

    Generation of Sine wave and Square wave using TMS320C6713 DSK

    Name: Md Arif Ahmed

    Roll NO: 12H66D7007

    Date: 28/09/2013

    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 functionsine,of which it is thegraph.It occurs often in pure andappliedmathematics,as well asphysics,engineering,signal processing and many other fields. Its

    most basic form as a function of time (t) is:

    where:

    A, theamplitude,is the peak deviation of the function from zero.

    f, theordinary frequency,is thenumber of oscillations (cycles) that occur each second of

    time.

    = 2f, theangular frequency,is the rate of change of the function argument in units of

    radiansper second

    , thephase,specifies (in radians) where in its cycle the oscillation is at t = 0.

    http://en.wikipedia.org/wiki/Curvehttp://en.wikipedia.org/wiki/Oscillationhttp://en.wikipedia.org/wiki/Sinehttp://en.wikipedia.org/wiki/Graph_of_a_functionhttp://en.wikipedia.org/wiki/Mathematicshttp://en.wikipedia.org/wiki/Physicshttp://en.wikipedia.org/wiki/Engineeringhttp://en.wikipedia.org/wiki/Signal_processinghttp://en.wikipedia.org/wiki/Amplitudehttp://en.wikipedia.org/wiki/Frequencyhttp://en.wikipedia.org/wiki/Real_numberhttp://en.wikipedia.org/wiki/Angular_frequencyhttp://en.wikipedia.org/wiki/Radianhttp://en.wikipedia.org/wiki/Phase_%28waves%29http://en.wikipedia.org/wiki/Phase_%28waves%29http://en.wikipedia.org/wiki/Radianhttp://en.wikipedia.org/wiki/Angular_frequencyhttp://en.wikipedia.org/wiki/Real_numberhttp://en.wikipedia.org/wiki/Frequencyhttp://en.wikipedia.org/wiki/Amplitudehttp://en.wikipedia.org/wiki/Signal_processinghttp://en.wikipedia.org/wiki/Engineeringhttp://en.wikipedia.org/wiki/Physicshttp://en.wikipedia.org/wiki/Mathematicshttp://en.wikipedia.org/wiki/Graph_of_a_functionhttp://en.wikipedia.org/wiki/Sinehttp://en.wikipedia.org/wiki/Oscillationhttp://en.wikipedia.org/wiki/Curve
  • 8/10/2019 experimentno-131231022848-phpapp01

    33/42

    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 steadyfrequency

    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 andsignal processing.

    Source code for Sine wave:

    #include

    #include

    float a[500];

    void main()

    {

    int i=0;

    for(i=0;i

  • 8/10/2019 experimentno-131231022848-phpapp01

    34/42

    Source code for square wave:

    #include

    #include

    int a[1000];

    void main()

    {

    int i,J=0;

    int b=5;

    for(i=0;i

  • 8/10/2019 experimentno-131231022848-phpapp01

    35/42

    EXPERIMENT NO: 11

    Generation of FIR Filter using TMS320C6713 DSK

    Name: Md Arif Ahmed

    Roll NO: 12H66D7007

    Date: 28/09/2013

    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 toinfinite impulse response (IIR) filters, which may have internal

    feedback and may continue to respond indefinitely (usually decaying). Theimpulse 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 byconvolving its input signal x with itsimpulse responseb.

    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]:

    http://en.wikipedia.org/wiki/Signal_processinghttp://en.wikipedia.org/wiki/Filter_%28signal_processing%29http://en.wikipedia.org/wiki/Impulse_responsehttp://en.wikipedia.org/wiki/Impulse_responsehttp://en.wikipedia.org/wiki/Infinite_impulse_responsehttp://en.wikipedia.org/wiki/Impulse_responsehttp://en.wikipedia.org/wiki/Discrete-timehttp://en.wikipedia.org/wiki/Continuous-timehttp://en.wikipedia.org/wiki/Digital_datahttp://en.wikipedia.org/wiki/Analog_circuitshttp://en.wikipedia.org/wiki/Convolutionhttp://en.wikipedia.org/wiki/Impulse_responsehttp://en.wikipedia.org/wiki/Discrete-timehttp://en.wikipedia.org/wiki/Discrete-timehttp://en.wikipedia.org/wiki/Impulse_responsehttp://en.wikipedia.org/wiki/Convolutionhttp://en.wikipedia.org/wiki/Analog_circuitshttp://en.wikipedia.org/wiki/Digital_datahttp://en.wikipedia.org/wiki/Continuous-timehttp://en.wikipedia.org/wiki/Discrete-timehttp://en.wikipedia.org/wiki/Impulse_responsehttp://en.wikipedia.org/wiki/Infinite_impulse_responsehttp://en.wikipedia.org/wiki/Impulse_responsehttp://en.wikipedia.org/wiki/Impulse_responsehttp://en.wikipedia.org/wiki/Filter_%28signal_processing%29http://en.wikipedia.org/wiki/Signal_processing
  • 8/10/2019 experimentno-131231022848-phpapp01

    36/42

    where :

    is the input signal,

    is the output signal,

    are thefilter coefficients, also known as tap weights, that make up the impulse

    response,

    is the filter order; anth-order filter has terms on the right-hand side.

    Source code:

    #include

    #include

    # 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

  • 8/10/2019 experimentno-131231022848-phpapp01

    37/42

  • 8/10/2019 experimentno-131231022848-phpapp01

    38/42

    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 bit-

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

  • 8/10/2019 experimentno-131231022848-phpapp01

    39/42

    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.

  • 8/10/2019 experimentno-131231022848-phpapp01

    40/42

    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.

  • 8/10/2019 experimentno-131231022848-phpapp01

    41/42

    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.

  • 8/10/2019 experimentno-131231022848-phpapp01

    42/42

    Output:

    Minimum distance of hamming code is 2