m Annuals

download m Annuals

of 15

Transcript of m Annuals

  • 8/22/2019 m Annuals

    1/15

    B. N COLLEGE OF ENGINEERING AND TECHNOLOGY, LUCKNOW

    Department of Electronics & Communication Engineering

    DIGITAL SIGNAL PROCESSING LAB (EEC 652)

    LIST OF EXPERIMENTS:

    1. To Study Circular Convolution

    2. Study of FIR Filter and plotting frequency response

    3. Generate Amplitude Modulation and observe the Characteristic

    4. Evaluation of DFT of a given sequence.

    5. Implement the filter function

    6. Generate a Random Binary Data Stream

    7. Study of Sampling and study of Aliasing of signal using Mat lab

  • 8/22/2019 m Annuals

    2/15

    B. N COLLEGE OF ENGINEERING AND TECHNOLOGY, LUCKNOW

    Department of Electronics & Communication Engineering

    DIGITAL SIGNAL PROCESSING LAB (EEC 652)

    EXPERIMENT NO 1

    Object: To Study Circular Convolution

    Apparatus Required: DSP KIT with processor DSK6713

    Personal computer CRO

    Procedure:

    1. Creating a new project

    2. Creating a new configuration file

    3. Adding files to a project

    4. Reviving the source code

    5. Building the program

    6. Enabling the RTDX channel

    7. Displaying the graphs

    Mat lab program:

    function y=circular_convolution(x,h)

    x= input ('enter the first sequence');

    h= input ('enter the second sequence');

  • 8/22/2019 m Annuals

    3/15

    N1= length(x);

    N2= length(h);

    N=max(N1,N2);%length of sequence

    x=[x zeros(1,N-N1)]; %modified first sequence

    h=[h zeros(1,N-N2)]; %modified second sequence

    for n=0:N-1;

    y(n+1)=0;

    for i=0:N-1

    j=mod(n-i,N);

    y(n+1)=y(n+1)+x(i+1)*h(j+1); %shifting and addingend

    %to display and plot circular convolution

    n=1:N;

    disp('output sequence of circular convolution');

    disp(y);%to view output in command window

    pause;

    stem(n,y);%plotting circular convolution

    grid minor;

    xlabel('time index');

    ylabel('amplitude');

    title('circular convolution sequence of x and h');

    RESULT : We observe the desired output.

  • 8/22/2019 m Annuals

    4/15

    B. N COLLEGE OF ENGINEERING AND TECHNOLOGY, LUCKNOW

    Department of Electronics & Communication Engineering

    DIGITAL SIGNAL PROCESSING LAB (EEC 652)

    EXPERIMENT NO 2

    Object: Study of FIR Filter and plotting frequency response.

    Apparatus Required: DSP KIT with processor DSK6713

    Personal computer CRO

    Procedure:

    1. Creating a new project

    2. Creating a new configuration file

    3. Adding files to a project

    4. Reviving the source code

    5. Building the program

    6. Enabling the RTDX channel

    7. Displaying the graphs

    Mat lab program:

    Fs=10000; % Sampling frequency

    N=41; % Filter length

    WT=[10 3 10]; % Weights of the deviations in the bands

    Hd=[0 0 1 1 0 0]; % Desired magnitude response in the bands

  • 8/22/2019 m Annuals

    5/15

    F=[0 0.1 0.2 0.3 0.4 1]; % Band edge frequencies

    b = remez(N-1, F, Hd, WT); % Compute the filter coefficients

    [H, f] = freqz(b, 1, 512, Fs);% Compute the frequency response

    mag = 20*log10(abs(H)); % of filter and plot it

    plot(f, mag), grid on

    xlabel('Frequency (Hz)')

    ylabel('Magnitude (dB)')

    RESULT : We observe the desired output.

  • 8/22/2019 m Annuals

    6/15

    B. N COLLEGE OF ENGINEERING AND TECHNOLOGY, LUCKNOW

    Department of Electronics & Communication Engineering

    DIGITAL SIGNAL PROCESSING LAB (EEC 652)

    EXPERIMENT NO 3

    Object: Generate Amplitude Modulation and observe the Characteristic

    Apparatus Required: DSP KIT with processor DSK6713

    Personal computer CRO

    Procedure:

    1. Creating a new project

    2. Creating a new configuration file

    3. Adding files to a project

    4. Reviving the source code

    5. Building the program

    6. Enabling the RTDX channel

    7. Displaying the graphs

    Mat lab program:

    t=0:0.001:1;

    vd=8*cos(2*pi*5*t);

    vc=0.1*cos(2*pi*15*t);

    ft=vc.*vd;

    am=ft+vc;

  • 8/22/2019 m Annuals

    7/15

    figure(1)

    plot(t,vd);

    figure(2)

    plot(t,vc);

    figure(3)

    plot(t,am);

    RESULT : We observe the desired output.

  • 8/22/2019 m Annuals

    8/15

    B. N COLLEGE OF ENGINEERING AND TECHNOLOGY, LUCKNOW

    Department of Electronics & Communication Engineering

    DIGITAL SIGNAL PROCESSING LAB (EEC 652)

    EXPERIMENT NO 4

    Object: Evaluation of DFT of a given sequence.

    Apparatus Required: DSP KIT with processor DSK6713

    Personal computer CRO

    Procedure:

    1. Creating a new project

    2. Creating a new configuration file

    3. Adding files to a project

    4. Reviving the source code

    5. Building the program

    6. Enabling the RTDX channel

    7. Displaying the graphs

    Mat lab program:

    %DFT by Direct Method (dsp8t3.m)

    disp('Performs DFT on windowed cosine wave');

    disp('Set relative frequency of cosine wave: ');

    W=pi/4;

    N = 64 ; % DFT order;

  • 8/22/2019 m Annuals

    9/15

    Invers = 0; % Specifies DFT rather than inverse DFT

    % Store N samples of cos(W*n) as test signal:- }

    for n =0 : N-1

    x(n+1) = cos(n*W) + j* 0 ;

    end;

    figure (1); plot([0:N-1],x); grid on;

    % Start DFT procedure:-

    if Invers ==1

    E = -2*pi/N

    elseE = 2*pi/N

    end;

    for k=0 : N-1

    X(1+k) = 0 + j*0 ; Wk =k*E ;

    for L = 0 : N-1

    C = cos(L*Wk) + j *sin(L*Wk);

    X(1+k) = X(1+k) + x(1+L) * C;

    end;

    if (Invers == 1)

    X(1+k)=X(1+k)/N;

    end;

    end;

    figure(2); plot([0:N-1] , abs(X),'r* '); grid on;

    RESULT : We observe the desired output.

  • 8/22/2019 m Annuals

    10/15

    B. N COLLEGE OF ENGINEERING AND TECHNOLOGY, LUCKNOW

    Department of Electronics & Communication Engineering

    DIGITAL SIGNAL PROCESSING LAB (EEC 652)

    EXPERIMENT NO 5

    Object: Implement the filter function

    Apparatus Required: DSP KIT with processor DSK6713

    Personal computer CRO

    Procedure:

    1. Creating a new project

    2. Creating a new configuration file

    3. Adding files to a project

    4. Reviving the source code

    5. Building the program

    6. Enabling the RTDX channel

    7. Displaying the graphs

    Mat lab program:

    N=10; % length of test input signal

    NB=N/2; % block length

    x = 1:N; % test input signal

  • 8/22/2019 m Annuals

    11/15

    B = [1,1]; % feedforward coefficients

    A = 1; % feedback coefficients (no-feedback case)

    [y1, Sf] = filter(B,A,x(1:NB)); % process block 1

    y2 = filter(B,A,x(NB+1:N),Sf); % process block 2

    for i=1:NB % print input and output for block 1

    disp(sprintf('x(%d)=%f\ty(%d)=%f',i,x(i),i,y1(i)));

    end

    for i=NB+1:N % print input and output for block 2disp(sprintf('x(%d)=%f\ty(%d)=%f',i,x(i),i,y2(i-NB)));

    end

    RESULT : We observe the desired output.

  • 8/22/2019 m Annuals

    12/15

    B. N COLLEGE OF ENGINEERING AND TECHNOLOGY, LUCKNOW

    Department of Electronics & Communication Engineering

    DIGITAL SIGNAL PROCESSING LAB (EEC 652)

    EXPERIMENT NO 6

    Object: Generate a Random Binary Data Stream

    Apparatus Required: DSP KIT with processor DSK6713

    Personal computer CRO

    Procedure:

    1. Creating a new project

    2. Creating a new configuration file

    3. Adding files to a project

    4. Reviving the source code

    5. Building the program

    6. Enabling the RTDX channel

    7. Displaying the graphs

    Mat lab program:

    % Setup

    % Define parameters.

  • 8/22/2019 m Annuals

    13/15

    M = 16; % Size of signal constellation

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

    n = 3e4; % Number of bits to process = 30,000

    Fd=1;Fs=1; %Input message sampling frequency, output message sampling

    frequency

    nsamp = 1; % Oversampling 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');

    RESULT : We observe the desired output.

  • 8/22/2019 m Annuals

    14/15

    B. N COLLEGE OF ENGINEERING AND TECHNOLOGY, LUCKNOW

    Department of Electronics & Communication Engineering

    DIGITAL SIGNAL PROCESSING LAB (EEC 652)

    EXPERIMENT NO 7

    Object: Study of Sampling and study of Aliasing of signal using Mat lab

    Apparatus Required: DSP KIT with processor DSK6713

    Personal computer CRO

    Procedure:

    1. Creating a new project

    2. Creating a new configuration file

    3. Adding files to a project

    4. Reviving the source code

    5. Building the program

    6. Enabling the RTDX channel

    7. Displaying the graphs

    Mat lab program:

    Sampling:

    x(n) = xa(nTs)

    x is a discrete signal sampled from the analog signal xa with a sample periodof Ts and a

    sample frequency of Fs = 1/Ts.

    Try:

    Fs = 100;

    N = 1000;

    stoptime = 9.99;

    t1 = (0:N-1)/Fs;

  • 8/22/2019 m Annuals

    15/15

    t2 = 0:1/Fs:stoptime;

    x1 = sin(2*pi*2*t1);

    x2 = sin(2*pi*3*t2);

    plot(x1)

    figure, plot(x2)

    Aliasing:

    Digital signals are often derived by sampling a continuous-time signal with

    an analog-to digital (A/D) converter. If the continuous signal, xa(t), is band

    limited, meaning that it does not contain any frequencies higher than a

    maximum frequency fM, the Shannon sampling theorem says that it can be

    completely recovered from a set of samples if the sampling frequency fs is

    greater than two times the maximum frequency of the signal to be sampled:

    Fs > 2fM

    This maximum frequency fM is known as the Nyquist frequency. If the

    sampling frequency is not greater than two times the Nyquist frequency, the

    continuous signal cannot be uniquely recovered and aliasing occurs. (You

    heard examples of aliased signals in Homework No.1).

    fs > 2fM: Original signal and sampled signal have the same frequency.

    fs _ 2fM: Sampled signal is aliased to half the original frequency.

    t = 0:0.001:2;xa = sin(2*pi*5*t);

    plot(t,xa)

    hold on

    fs = 15;

    ts = 0:1/fs:2;

    xs1 = sin(2*pi*5*ts);

    plot(ts,xs1,ro-)

    fs = 7.5;

    ts = 0:1/fs:2;

    xs2 = sin(2*pi*5*ts);

    plot(ts,xs2,ro-)

    hold off

    RESULT: We observe the desired output.