EE-493 Digital Signal Processing _ 2013

Embed Size (px)

Citation preview

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    1/37

    PRACTICAL WORK BOOKFor Academic Session 2013

    Digital Signal Processing (EE-493)For

    BE (EE)&BE (EL)

    Name:

    Roll Number:

    Class:

    Batch: Semester/Term:

    Department :

    Department of Electrical EngineeringNEDUniversity of Engineering & Technology

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    2/37

    CONTENTS

    Lab.

    No.Dated Title of Experiments

    Page

    NoRemarks

    1 Effects of Sampling in Discrete TimeSignals.

    01-03

    2Effects of Quantization in Discrete Time

    Continuous Valued Signals.04-06

    3 Discrete-Time Convolution. 07-08

    4 Discrete-TimeCorrelation. 0 9 -10

    5Studying Time Frequency Characteristics

    using Continuous Time Fourier Series11-12

    6Studying Discrete Fourier Transform

    using an audio signal example.13-14

    7(a) Relationship between Laplaceand CTFT. 15-16

    7(b)Relationship between Z transform and

    DTFT.17-18

    8 Designing FIR and IIR Filters. 19-21

    9Generation of sine waves and plotting with

    CSS usingC-6713 DSK.22-24

    10 Generation of sine waves using interrupts 25-26

    11Computation of DFT using FFT

    Algorithmsin C -6713 DSK.27-28

    12 Designing Digital Filterusing C-6713DSK.

    29-30

    13 Appendices 31-35

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    3/37

    Digital Signal Processing Lab Session 01NED University of Engineering and Technology Department of Electrical Engineering

    - 1 -

    LAB SESSION 01

    Effects of Sampling in Discrete Time Signals

    OBJECTIVE:

    1.

    Simulate and plot two CT signals of 10 Hz and 110 Hz for 0 < t < 0.2 secs.

    2.

    Sample at Fs = 100 Hz and plot them in discrete form.

    3.

    Observe and note the aliasingeffects.

    4.

    Explore and learn.

    THEORY:

    This practical covers the topics of lectures 1-6, and are supported by sections 1.3 and 1.4 of

    your text book (DSP by Proakis, 4thEd).

    PROCEDURE:

    1. Make a folder at desktop and name it as your current directory within MATLAB.

    2.

    Open M-file editor and type the following code:

    cl ear al l ;

    cl ose al l ;

    cl c;

    F1 = 10;

    F2 = 110;Fs = 100;

    Ts = 1/ Fs;

    t = [ 0 : 0. 0005 : 0. 2] ;

    x1t = cos( 2*pi *F1*t ) ;

    x2t = cos( 2*pi *F2*t ) ;

    f i gure,

    pl ot ( t , x1t , t , x2t , ' Li neWi dt h' , 2) ;

    xl abel ( ' cont t i me ( sec) ' ) ;yl abel ( ' Amp' ) ;

    xl i m( [ 0 0. 1] ) ;

    gr i d on;

    l egend( ' 10Hz' , ' 110Hz' ) ;

    t i t l e( ' Two CTCV si nusoi ds pl ot t ed' ) ;

    3.

    Save the file as P011.m in your current directory and run it, either using F5 key or

    writing the file name at the command window.

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    4/37

    Digital Signal Processing Lab Session 01NED University of Engineering and Technology Department of Electrical Engineering

    - 2 -

    4.

    Check for the correctness of the time periods of both sinusoids.

    5.Now add the following bit of code at the bottom of your P011.m file and save.

    nTs = [ 0 : Ts : 0. 2] ;

    n = [ 1 : l engt h( nTs) - 1 ] ;

    x1n = cos( 2*pi *F1*nTs) ;

    x2n = cos( 2*pi *F2*nTs) ;

    f i gure,

    subpl ot ( 2, 1, 1) ,

    st em( nTs, x1n, ' Li neWi dt h' , 2) ;

    gr i d on;

    t i t l e( ' 10Hz sampl ed' ) ;

    xl abel ( ' di scr et e t i me ( sec) ' ) ;

    yl abel ( ' Amp' ) ;

    xl i m( [ 0 0. 1] ) ;

    subpl ot ( 2, 1, 2)

    st em( nTs, x2n, ' Li neWi dt h' , 2) ;

    gr i d on;

    t i t l e( ' 110Hz sampl ed' )

    xl abel ( ' di scr et e t i me ( sec) ' ) ;

    yl abel ( ' Amp' ) ;

    xl i m( [ 0 0. 1] ) ;

    6.

    Before hitting the run, just try to understand what the code is doing and try to link it with

    what we have studied in classes regarding concepts of frequency for DT signals.7.

    Now run the file and observe both plots.

    8.

    To see what is really happening, type the following code at the bottom of your existing

    P011.m file and run again.

    figure,plot(t,x1t,t,x2t);

    holdstem(nTs,x1n,'r','LineWidth',2);

    xlabel('time (sec)');

    ylabel('Amp');

    xlim([0 0.05]);

    legend('10Hz','110Hz');

    9.

    Observe the plots.

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    5/37

    Digital Signal Processing Lab Session 01NED University of Engineering and Technology Department of Electrical Engineering

    - 3 -

    RESULT:

    Explain (write) in your own words the cause and effects of what you just saw.

    EXERCISE:

    This needs to be completed before your next practical and saved.

    Consider the following CT signal: x(t) = sin (2 pi F0t). The sampled version will be: x(n) =

    sin (2 pi F0/Fs n), where n is a set of integers and sampling interval Ts=1/Fs.

    Plot the signal x(n) for n = 0 to 99 for Fs = 5 kHz and F1 = 0.5, 2, 3 and 4.5 kHz. Explain the

    similarities and differences among various plots.

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    6/37

    Digital Signal Processing Lab Session 02NED University of Engineering and Technology Department of Electrical Engineering

    - 4 -

    LAB SESSION 02

    Effects of Quantization in Discrete Time Continuous Valued

    Signals

    OBJECTIVE:

    1.Simulate a DTCV sinusoid of 1/50 cycles/sample with length of the signal be 500.

    2.Choose the no. of significant digits for round-off and apply to the signal generated above.

    3.Compute the error signals and SQNR.

    4.Explore and observe.

    THEORY:

    In this session, we will generate DTCV sinusoids and quantize them. We shall measure the

    quantization noise signals and the quality of the quantization process.The error signal is given as: xe(n)= x(n)-xq(n). Where,xq(n)is the quantized signal.

    The resolution of the quantizer is given as: max min

    1

    x x

    L, where L is the no. of

    quantization levels.

    The quality of the quantized signal is measured by the signal-to-quantization noise ratio

    (SQNR) which is mathematically written as: SQNR = 10e

    x

    P

    P10log Px and Pe are average

    powers of the DTCV and quantized signal respectively, and may be written as:1

    2

    0

    1( )

    N

    x

    n

    P x nN

    and.1

    0

    2

    )()(1 N

    n

    qe nxnxN

    P

    This practical is supported by section 1.4.3 of your text book (4thEd).

    PROCEDURE:

    1. Make a folder at desktop and name it as your current directory within MATLAB.

    2. Open M-file editor and write the following code:

    clear all;

    close all;

    clc;

    fd1 = 1/50;n = [0 : 499 ];

    q=input('No. of Digits after decimal points to be retained (0-9): ');

    x1 = cos(2*pi*fd1*n);

    Px1 = sum(abs(x1).^2)/length(x1);

    x1q = round(x1*10^q)/10^q;

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    7/37

    Digital Signal Processing Lab Session 02NED University of Engineering and Technology Department of Electrical Engineering

    - 5 -

    x1e = x1 -x1q;

    Pe1 = sum(abs(x1e).^2)/length(x1e);

    SQNR = 10*log10(Px1/Pe1);

    disp(['The Signal to Quantization Noise Ratio is: ' num2str(SQNR) '

    dB.' ]);figure,

    subplot(2,1,1);

    plot(n,x1,n,x1q);

    xlabel('indices');

    ylabel('Amp');

    xlim([0 49]);

    ylim([-1.1 1.1]);

    legend('DTCV','DTDV');

    subplot(2,1,2);

    plot(n,x1e);

    xlabel('indices');

    ylabel('Error');

    xlim([0 49]);

    3. Save the file as P021.min your current directory and run it.

    4. Explore and take notes.

    5. Now modify the above code as follows and save as another file P022.m.

    clear all;

    close all;

    clc;

    fd1 = 1/50;

    n = [0 : 499 ];

    q = [0 : 10]; %No. of Digits after decimal points to be retained

    for num = 1 : length(q)

    x1 = cos(2*pi*fd1*n);

    Px1 = sum(abs(x1).^2)/length(x1);

    x1q = round(x1*10^q(num))/10^q(num);

    x1e = x1 -x1q;

    Pe1 = sum(abs(x1e).^2)/length(x1e);

    SQNR(num) = 10*log10(Px1/Pe1);

    end

    figure,

    plot(q,SQNR);

    xlabel('Significant Digits');

    ylabel('SQNR (dB)');

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    8/37

    Digital Signal Processing Lab Session 02NED University of Engineering and Technology Department of Electrical Engineering

    - 6 -

    yl abel ( ' SQNR ( dB) ' ) ;

    xl i m( [ q( 1) q( end) ] ) ;

    6. Before hitting the run, just try to understand what the code is doing and try to link it with

    the previous code.

    7. Now run the file and observe the results.

    RESULT:

    Explain (write) in your own words the cause and effects of what you just saw.

    EXERCISE:

    Do Exercise 1.16 of Proakis (4thEd) in MATLAB and bring it in your next lab.

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    9/37

    Digital Signal Processing Lab session 03NED University of Engineering and Technology Department of Electrical Engineering

    - 7 -

    LAB SESSION 03

    Discrete-Time Convolution

    OBJECTIVE:

    1. We have the impulse response of a system as ( ) {3, 2,1, 2,1, 0, 4, 0, 3}h n

    = .

    2. For ( ) {1, 2,3, 4,3, 2,1}x n

    = , findy(n).

    3. Modify the code such that ( ) {3, 2,1, 2,1, 0, 4, 0, 3}h n

    = - (origin is shifted), and check

    the causality property mentioned above (Theory point 3).

    THEORY:

    1. Convolution is given as: ( ) ( ) ( ) ( ) ( ) ( ) ( )k k

    y n x n h n x k h n k h k x n k

    = =

    = = = . i.e.

    one can compute the outputy(n)to a certain inputx(n)when impulse response h(n)of that

    system is known. Convolution holds commutative property.

    2. The length of the resulting convolution sequence is N+M-1, where, N and M are the

    lengths of the two convolved signals respectively.

    3. In Causal Systems, the output only depends on the past and/or present values of inputs and

    NOT on future values. This means that the impulse response h(n)of a causal system will

    always exist only for 0.n

    This practical is supported by section 2.3.3 of your text book (4thEd).

    PROCEDURE:

    1. Make a folder at desktop and name it as your current directory within MATLAB.

    2. Open M-file editor and write the following code:

    cl ear al l ;

    cl ose al l ;

    cl c;

    h = [ 3 2 1 - 2 1 0 - 4 0 3] ; % i mpul se r esponse

    org_h = 1; % Sampl e number where or i gi n exi st s

    nh = [ 0 : l engt h( h) - 1] - org_h + 1;

    x = [ 1 - 2 3 - 4 3 2 1] ; % i nput sequence

    org_x = 1; % Sampl e number where or i gi n exi st s

    nx = [ 0 : l engt h( x) - 1] - org_x + 1;

    y = conv(h, x) ;

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    10/37

    Digital Signal Processing Lab session 03NED University of Engineering and Technology Department of Electrical Engineering

    - 8 -

    ny = [ nh(1)+ nx( 1) : nh( end)+nx( end)] ;

    f i gure,

    subpl ot ( 3, 1, 1) ,

    st em( nh, h) ;

    xl abel ( ' Ti me i ndex n' ) ; yl abel ( ' Ampl i t ude' ) ;xl i m( [ nh( 1) - 1 nh( end) +1] ) ;

    t i t l e( ' I mpul se Response h( n) ' ) ; gri d;

    subpl ot ( 3, 1, 2) ,

    st em( nx, x) ;

    xl abel ( ' Ti me i ndex n' ) ; yl abel ( ' Ampl i t ude' ) ;

    xl i m( [ nx(1)- 1 nx(end) +1] ) ;

    t i t l e( ' I nput Si gnal x(n) ' ) ; gr i d;

    subpl ot ( 3, 1, 3)

    st em( ny, y) ;

    xl abel ( ' Ti me i ndex n' ) ; yl abel ( ' Ampl i t ude' ) ;

    xl i m( [ ny(1)- 1 ny(end) +1] ) ;

    t i t l e( ' Out put Obt ai ned by Convol ut i on' ) ; gr i d;

    3. Save the file as P031.min your current directory and run it.

    4. Try to learn, explore the code and make notes.

    5. Now modify the above code as mentioned in objectives above and check for causality.

    RESULT:

    EXERCISE:

    1.

    What will happen if we input ( ) {0, 0,1, 0, 0}x n

    = into the above system.

    2. Can you prove commutative property of the convolution?

    3. Modify the code to prove Associative and Distributive properties of the convolution

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    11/37

    Digital Signal Processing Lab session 04NED University of Engineering and Technology Department of Electrical Engineering

    - 9 -

    LAB SESSION 04

    Discrete-Time CorrelationOBJECTIVE:

    1. Generate two sinusoids of length 10 and fd = 0.1 with variable phase.

    2. Apply correlation and check for certain properties such as magnitude and location of

    maximum correlation with varying phases.

    3. Also, to verify whether the lag zero auto-correlation gives the energy of the signal.

    4. Compute correlation using convolution command.

    THEORY:

    1. Correlation is given as: ( ) ( ) ( ) ( ) ( ).xyn n

    r l x n y n l x n l y n

    = =

    = = + . Where l is the

    lag. This is called cross-correlation and it gives the magnitude and location of similarity

    between two signals. The correlation between y(n) and x(n) is not necessarily the same as

    the correlation between x(n) and y(n). It is given as:

    ( ) ( ) ( ) ( ) ( ).yxn n

    r l y n x n l y n l x n

    = =

    = = +

    2.

    Generally, ( ) ( )xy yxr l r l= . These two are the same when x(n) and y(n) are the same

    signals or when x(n) and y(n) are even symmetric signals.

    3.

    The length of the resulting correlation sequence is N+M-1, where, N and M are the

    lengths of the two signals

    4.

    Correlation may also be computed using convolution algorithm with a modification that

    we need to fold one of the signals before applying the convolution. Mathematically,

    ( ) ( ) ( )xyr n x n y n= .

    PROCEDURE:

    1. Make a folder at desktop and name it as your current directory within MATLAB.

    2. Open M-file editor and write the following code:

    cl ear al l ;

    cl ose al l ;cl c;

    n = [ 0: 9] ;

    ph1 = 0;

    ph2 = 0;

    x = si n( 2*pi *0. 1*n + ph1) ;

    org_x = 1;

    nx = [ 0 : l engt h( x) - 1] - org_x + 1;

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    12/37

    Digital Signal Processing Lab session 04NED University of Engineering and Technology Department of Electrical Engineering

    - 10 -

    y = si n( 2*pi *0. 1*n + ph2) ;

    org_y = 1;

    ny = [ 0 : l engt h( y) - 1] - org_y + 1;

    r xy = xcor r ( x, y) ;nr = [ nx(1)- ny( end) : nx( end) - ny(1) ] ;

    [ maxR i ndR] = max( r xy) ;

    di sp( [ ' The cor r el at i on at l ag zer o i s: ' num2st r ( r xy( f i nd( nr ==0) ) )

    ' . ' ] ) ;

    di sp( [ ' The maxi mum cor r el at i on i s at l ag ' num2str ( nr ( i ndR) ) ' . ' ] ) ;

    f i gure,

    subpl ot ( 3, 1, 1) ,

    st em( nx, x) ;

    xl abel ( ' Ti me i ndex n' ) ; yl abel ( ' Ampl i t ude' ) ;

    xl i m( [ nx(1)- 1 nx(end) +1] ) ;

    t i t l e( ' Si gnal x(n) ' ) ; gr i d;

    subpl ot ( 3, 1, 2) ,

    st em( ny, y) ;

    xl abel ( ' Ti me i ndex n' ) ; yl abel ( ' Ampl i t ude' ) ;

    xl i m( [ ny(1)- 1 ny(end) +1] ) ;

    t i t l e( ' Si gnal y(n) ' ) ; gr i d;

    subpl ot ( 3, 1, 3)

    st em( nr , r xy) ;

    xl abel ( ' Ti me i ndex n' ) ; yl abel ( ' Ampl i t ude' ) ;

    xl i m( [ nr ( 1) - 1 nr ( end) +1] ) ;t i t l e( ' Cross Corr el at i on' ) ; gr i d;

    3. Save the file as P041.min your current directory and run it.

    4. Learn the specific logical bits of the code and make notes.

    5. Now modify the phase of the second signal to pi/2 (it will make it cosine) and observe the

    correlation at lag zero. Modify the phase again to pi and observe.

    6. Check for auto-correlation (ph1 = ph2) that the lag zero value gives the energy of the

    signal.

    7. Observe that the commutative property does not hold.

    RESULT:

    EXERCISE:

    Modify the code, such that the correlation is obtained using convolution command.

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    13/37

    Digital Signal Processing Lab session 05NED University of Engineering and Technology Department of Electrical Engineering

    - 11 -

    LAB SESSION 05

    Studying Time Frequency Characteristics using Continuous

    Time Fourier Series

    OBJECTIVE:

    1. Generate a square wave in time domain with certain time period and pulse width.

    2. Apply CTFS equation to compute spectral coefficients.

    3. Observe the plot to verify the properties mentioned above.

    4. Modify time-periods and pulse widths to assess the corresponding change in frequency

    domain.

    THEORY:

    In this session, we will explore the relation between time domain properties of the signal

    (Time period and Pulse Width) and frequency domain properties (Spectral density and Lobe

    width) using CTFS equations.

    The Analysis equation for CTFS is given as:/2

    2

    /2

    1( ) O

    Tpj F t

    KTp

    c x t e dt Tp

    = ; where Fo is the

    Fundamental Frequency and is the inverse of the Time period of the signal.

    1.

    The spectral spacing of the spectrum is equal to the inverse of the time period of the

    signal.

    2.

    The Lobe width of the spectrum is equal to the inverse of the pulse width of the signal.

    PROCEDURE:

    1. Make a folder at desktop and name it as your current directory within MATLAB.

    2. Open M-file editor and write the following code:

    cl ear al l ;

    cl c;

    cl ose al l ;

    Ts = 0. 001; %sampl i ng per i od - so smal l t o appr oxi mat e

    cont t i met = [ - 10: Ts: 9. 999 ] ; % Ti me Vect or - agai n appr ox. cont i nuous

    Tp = 1; % Ti me Per i od of t he si gnal

    t au = 0. 5; % Pul se Wi dt h - Dut y Cycl e

    x = ( 1+square( t *2*pi / Tp, t au*100) ) / 2; % Generat i ng Square wave

    f i gure,

    pl ot ( t , x) ;

    xl abel ( ' secs ' ) ;

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    14/37

    Digital Signal Processing Lab session 05NED University of Engineering and Technology Department of Electrical Engineering

    - 12 -

    yl i m([ - 1. 2 1. 2] ) ;

    pause; % Pr ess any key

    Fo = 1/ Tp; % Fundament al Fr equency

    % Extracting a portion of the signal equal to its period.

    I _per i od = f i nd( r ound( t *1000) / 1000 == - Tp/ 2) :

    f i nd( r ound( t *1000) / 1000 == Tp/ 2) ;

    xpor t = x( I _per i od ) ;

    f i gure,

    pl ot ( t ( I _per i od) , xport ) ;

    xl abel ( ' secs ' )

    yl i m( [ - 1. 2 1. 2] )

    pause % Pr ess any key

    % Computing CTFS Coefficients

    f or k = 1: 20

    B = exp( - j *2*pi *( k- 1) *Fo. *[ - Tp/ 2: Ts: Tp/ 2] ) ;

    C( k) = sum( xpor t . *B) / ( l engt h( xpor t ) *Tp) ;

    end

    kFo = Fo*[ 0: k- 1] ; % Frequency Scal e i n Hz.

    f i gure,

    st em( kFo, abs( C) ) ;

    t i t l e( ' CTFT Coef f i ci ents ' ) ;

    xl abel ( ' Hz ' ) ;

    RESULT:

    Explain (write) in your own words the cause and effects of what you just saw.

    EXERCISE:

    Now make the following modifications one by one and observe the effects.

    a. Change Tp to 2 secs and then to 0.5 secs.

    b.

    Change tau to 0.2.

    c.

    Change tau to 0.001 and see the spectra.

    d.

    Change tau to 1 and observe the spectra.

    Make notes about all observations and learn to play around with the code.

    Note: Do not change the sampling time, as this is an artificially made continuous-time

    signal. Also, do not increase Tp than 10 secs and reduce below 0.05 secs.

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    15/37

    Digital Signal Processing Lab session 06NED University of Engineering and Technology Department of Electrical Engineering

    - 13 -

    LAB SESSION 06

    Studying Discrete Fourier Transform using an audio signal

    OBJECTIVE:

    1. Load an audio file noisy.wav into Matlab.

    2. There is a tone added to the speech in this file. The objective is to find the frequency of this

    tone.

    3. Computing the DFT of this signal;4. Generating frequency vector in Hz.

    5. Displaying the DFT and observing the frequency of the added tone.

    THEORY:

    DF analysis equation:

    DFT synthesis eq:

    Frequency Resolution is given by .

    Sample frequencies are given by 1.

    PROCEDURE:

    1. Make a folder at desktop and name it as your current directory within MATLAB.2. Copy the audio file noisy.wav into your current directory.

    3. Open M file editor and write the following code:

    cl ear al l ; cl c; cl ose al l ;[ y, Fs, bi t s] = wavread( ' noi sy. wav' ) ;Ts = 1/ Fs;n = [0: l ength(y) - 1] ;t = n. *Ts ;k = n;Df = Fs. / l engt h( y);F = k. *Df ;Y = f f t ( y) ;magY = abs( Y);

    sound( y, Fs);f i gure,subpl ot ( 2, 1, 1) ;pl ot ( F, magY);gri d on;xl i m([ 0 Fs/ 2] ) ;xl abel ( ' Frequency (Hz)' ) ;yl abel ( ' DFT Magni t ude' ) ;t i t l e( ' Di screte Fouri er Transf orm' );subpl ot ( 2, 1, 2) ;pl ot ( F, magY);gri d on;

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    16/37

    Digital Signal Processing Lab session 06NED University of Engineering and Technology Department of Electrical Engineering

    - 14-

    xlim([0 2000]);

    xlabel('Frequency (Hz)');

    ylabel('DFT Magnitude');

    title('Discrete Fourier Transform');

    4. Save the file as P081.m in your current directory and run it.

    RESULT:

    Explore and take notes.

    EXERCISE

    Try and remove the tone spikes from the spectra of the noisy signal.

    Take Inverse DFT (IFFT) of the modified spectra.

    Listen to this new time-domain signal and see if the tone noise is removed.

    Note: This is actually a very crude of way of filtering which is covered later.

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    17/37

    Digital Signal Processing Lab session 07 (a)NED University of Engineering and Technology Department of Electrical Engineering

    - 15 -

    LAB SESSION 07(a)

    Relationship between Laplace and CTFT

    OBJECTIVE:

    1. Generate pole zero constellation in s plane.

    2. Plot corresponding Frequency (Bode magnitude) response.

    3. Plot impulse response and determine that the system is FIR or IIR.

    4. Modify location of poles in s plane to observe the corresponding change in frequency

    and impulse response.

    THEORY:

    The Laplace Transform of a general continuous time signal x (t) is defined as;

    X(S) =

    )(tx e-stdt.

    Where the complex variable s=+ j w, with and w the real and imaginary parts. CTFT is asubset of Laplace when =0. Since information is not present in CTFT, therefore

    information about stability can only be obtained from Laplace. If pole lies on L.H.S of s-

    plane, system is stable. If pole lies on R.H.S of s-plane, system is unstable. If pole lies ony(jw)-axis, system is marginally stable or oscillatory. If system has FIR, it is stable. If system

    is IIR, it can be stable or unstable.

    PROCEDURE:

    1.

    Make a folder at desktop and name it as your current directory within MATLAB.

    2.

    Open M-file editor and write the following code:

    cl ear al l ;

    cl ose al l ;

    cl c;

    Num = pol y([ (0- ( i * (pi / 2) ) ) , (0+( i *(pi / 2) ) ) ] ) ;

    Zer os=r oot s( Num)

    Den = pol y( [ - 1, - 1] ) ;

    pol es=r oot s( Den)

    sys=t f ( Num, Den)

    f i gure;

    subpl ot ( 3, 1, 1) ;

    pzmap( sys) ;

    xl i m( [- 2 2]) ;

    yl i m( [- 4 4]) ;

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    18/37

    Digital Signal Processing Lab session 07 (a)NED University of Engineering and Technology Department of Electrical Engineering

    - 16 -

    subpl ot ( 3, 1, 2) ;

    [ mag phase w] =bode( sys) ;

    mag=squeeze( mag) ;

    pl ot ( w, mag) ;

    subpl ot ( 3, 1, 3) ;i mpul se( sys) ;

    H=df i l t . df 1( Num, Den) ;

    A=i sf i r ( H)

    3.

    Save the file as P091.min your current directory and run it.

    RESULT:

    1.

    Learn the specific logical bits of the code and make notes.

    2. Observe the plots.

    3.

    Now, explain (write) in your own words the cause and effects of what you just saw.

    EXERCISE:

    Change the location of poles from L.H.S of s-plane to y axis first, and then to R.H.S of s-

    plane and observe the effects.

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    19/37

    Digital Signal Processing Lab session 07 (b)NED University of Engineering and Technology Department of Electrical Engineering

    - 17 -

    LAB SESSION 07(b)

    Relationship between z transform and DTFT

    OBJECTIVE:

    1. Generate pole zero constellation in z plane.

    2. Plot corresponding Frequency (Bode magnitude) response.

    3. Plot impulse response and determine that the system is FIR or IIR.

    4. Modify location of poles in z plane to observe the corresponding change in frequency

    and impulse response.

    THEORY:

    The z - Transform of a general discrete time signal x(n) is defined as;

    X (z) = =

    =

    n

    n

    nx )( z-n

    Where the complex variable z=r w , with r the radius and w the angle. DTFT is a subset of ztransform when r =1. Since r information is not present in DTFT, therefore information

    about stability in discrete time can only be obtained from z transform. If pole lies inside the

    unit circle, system is stable. If pole lies outside the unit circle, system is unstable. If pole liesat the unit circle, system is marginally stable or oscillatory. If system has FIR, it is stable. If

    system is IIR, it can be stable or unstable.

    PROCEDURE:

    1.

    Make a folder at desktop and name it as your current directory within MATLAB.

    2. Open M-file editor and write the following code:

    cl ear al l ;

    cl ose al l ;

    cl c;

    Num = pol y([ (0- ( i * (pi / 2) ) ) , (0+( i *(pi / 2) ) ) ] ) ;

    Den = pol y( [ - 1, - 1] ) ;

    Num1 = pol y( [ j , - j ] ) ;

    Den1 = pol y( [ exp( - 1) , exp( - 1) ] ) ;

    sys1=t f ( Num1, Den1, 1)

    f i gure;

    subpl ot ( 3, 1, 1) ;

    pzmap( sys1) ;

    xl i m( [- 2 2]) ;

    yl i m( [- 4 4]) ;

    subpl ot ( 3, 1, 2) ;

    [ mag phase w] =bode( sys1) ;

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    20/37

    Digital Signal Processing Lab session 07 (b)NED University of Engineering and Technology Department of Electrical Engineering

    - 18 -

    mag=squeeze( mag) ;

    pl ot ( w, mag) ;

    xl i m( [ 0 100] )

    subpl ot ( 3, 1, 3) ;i mpul se( sys1) ;

    H=df i l t . df 1( Num, Den) ;

    A=i sf i r ( H)

    f i gure;

    pzmap(sys1)

    gr i d on;

    3.

    Save the file as P010.min your current directory and run it.

    RESULT:

    1.

    Learn the specific logical bits of the code and make notes.

    2.

    Observe the plots.

    3. Now, explain (write) in your own words the cause and effects of what you just saw.

    EXERCISE:

    Change the location of poles from inside the unit circle to outside and at the unit circle and

    observe the effects.

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    21/37

    Digital Signal Processing Lab session 08NED University of Engineering and Technology Department of Electrical Engineering

    - 19 -

    LAB SESSION 08

    Designing FIR and IIR Filters

    OBJECTIVE:

    1.

    Create a signal vector containing two frequencies as: i) 100 Hz. and ii) 150 Hz., with

    Fs = 1000 Hz.

    2.

    Design two bandpass FIR filters with 64 coefficients and with passbands as i) 125 to

    175 Hz. and ii) 75 to 125 Hz.

    3.

    Use both filters on the created signal and observe their outputs.

    4. Plot frequency responses and pole-zero constellations of both filters and note

    observations.

    5.

    Repeat steps 2 4 for IIR filters designed using Butterworth IIR filters.

    THEORY:

    1.

    FIR filters are Finite Impulse Response filters with no feedback, whereas IIR contains

    feedback.

    2. Transfer function of FIR filter does not contain any non-trivial poles. Their frequency

    response is solely dependent on zero locations. IIR filters contain poles as well as

    zeros.

    3.

    As there are no poles, FIR filters cannot become unstable; however, IIR filters can

    become unstable if any pole lies outside the unit circle in z-plane.

    4. More number of coefficients is needed to design the desired filter in FIR than IIR.

    PROCEDURE:

    1.

    Write the following code for FIR filters:

    cl ose al l ; cl ear al l ; cl c;

    % Frequenci es i n Hz.

    F1 = 100;

    F2 = 150;

    % Sampl i ng Fr equency i n sampl es/ sec.

    Fs = 1000;

    t = [ 0 : 1/ Fs : 1] ; % Ti me Vector

    F = Fs*[0: l engt h( t ) - 1] / l engt h( t ) ; % Frequency Vect or

    x = exp( j *2*pi *F1*t ) +2*exp( j *2*pi *F2*t ) ; % Si gnal Vect or

    bh = f i r1( 64 , [ 125 175] / 500) ; % f i l t er coef f s. f or bandpassi ng F1

    bl = f i r1( 64 , [ 75 125] / 500) ; % f i l t er coef f s. f or bandpassi ng F2

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    22/37

    Digital Signal Processing Lab session 08NED University of Engineering and Technology Department of Electrical Engineering

    - 20 -

    [ hh, wh] =f r eqz( bh, 1, l engt h( t ) , ' whol e' ) ; % Frequency r esponse f or f i l t er

    1

    [ hl , wl ] =f reqz(bl , 1, l engt h( t ) , ' whol e' ) ; % Frequency response f or f i l t er

    2

    % Fi l ter operat i on - see f i l t f i l t i n hel p to l earn what i t does

    yh = f i l t f i l t ( bh, 1, x) ;

    yl = f i l t f i l t ( bl , 1, x) ;

    % Pl ot t i ng

    f i gure,

    subpl ot ( 5, 1, 1) , pl ot ( F, abs( f f t ( x) ) ) ; xl i m([ 0 Fs /2] ) ;

    t i t l e( ' FFT of orgi anl s i gnal ' ) ;

    subpl ot (5, 1, 2), pl ot( F,abs(hh)) ; xl i m([ 0 Fs/ 2] ) ;

    t i t l e( ' Frequency r esponse of Fi l t er One' ) ;

    subpl ot (5, 1, 3), pl ot( F,abs(f f t( yh) ) ) ; xl i m([ 0 Fs/ 2] ) ;

    t i t l e( ' FFT of f i l t ered s i gnal f romf i l ter one' ) ;

    subpl ot (5, 1, 4), pl ot( F,abs(hl )) ; xl i m([ 0 Fs/ 2] ) ;

    t i t l e( ' Frequency r esponse of Fi l t er Two' ) ;

    subpl ot ( 5, 1, 5) , pl ot ( F, abs( f f t ( yl ) ) ) ; xl i m([ 0 Fs /2] ) ;

    t i t l e( ' FFT of f i l t ered s i gnal f romf i l ter t wo' ) ;

    xl abel ( ' Hz . ' )

    % Pol e Zer o Const el l at i ons

    [ bh, ah] = eqt f l engt h( bh, 1) ;

    [ zh, ph, kh] = t f 2zp( bh, ah) ;

    [bl , al ] = eqt f l ength(bl , 1);

    [ z l , pl , kl ] = t f 2zp(bl , al ) ;

    f i gure,

    subpl ot (1, 2, 1), zpl ane(bh, ah) ; xl i m( [- 1. 5 1. 5] ) ; yl i m([ - 1. 5 1. 5]) ;

    t i t l e( ' Fi l t er One' ) ;

    subpl ot (1, 2, 2), zpl ane(bl , al ) ; xl i m( [- 1. 5 1. 5] ) ; yl i m([ - 1. 5 1. 5]) ;

    t i t l e( ' Fi l t er Two' ) ;

    2. Note the observations from frequency response and pole-zero constellation plots.

    3. Now, write the code in another program for IIR filters:

    cl ose al l ; cl ear al l ; cl c;

    % Frequenci es i n Hz.

    F1 = 100;

    F2 = 150;

    % Sampl i ng Fr equency i n sampl es/ sec.

    Fs = 1000;

    t = [ 0 : 1/ Fs : 1] ; % Ti me Vector

    F = Fs*[0: l engt h( t ) - 1] / l engt h( t ) ; % Frequency Vect or

    x = exp( j *2*pi *F1*t ) +2*exp( j *2*pi *F2*t ) ; % Si gnal Vect or

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    23/37

    Digital Signal Processing Lab session 08NED University of Engineering and Technology Department of Electrical Engineering

    - 21 -

    [ bh, ah] = but t er ( 6, [ 125 175] / 500) ; % f i l t er coef f s. f or bandpassi ng F1

    [ bl , al ] = but t er ( 6, [ 75 125] / 500) ; % f i l t er coef f s. f or bandpassi ng F2

    [ hh, wh] =f r eqz( bh, ah, l engt h( t ) , ' whol e' ) ; % Frequency r esponse f or

    f i l t er 1

    [ hl , wl ] =f reqz(bl , al , l engt h( t ) , ' whol e' ) ; % Frequency r esponse f or

    f i l t er 2

    % Fi l ter operat i on - see f i l t f i l t i n hel p to l earn what i t does

    yh = f i l t f i l t ( bh, ah, x) ;

    yl = f i l t f i l t ( bl , al , x) ;

    % Pl ot t i ng

    f i gure,

    subpl ot ( 5, 1, 1) , pl ot ( F, abs( f f t ( x) ) ) ; xl i m([ 0 Fs /2] ) ;

    t i t l e( ' FFT of orgi anl s i gnal ' ) ;

    subpl ot (5, 1, 2), pl ot( F,abs(hh)) ; xl i m([ 0 Fs/ 2] ) ;

    t i t l e( ' Frequency r esponse of Fi l t er One' ) ;

    subpl ot (5, 1, 3), pl ot( F,abs(f f t( yh) ) ) ; xl i m([ 0 Fs/ 2] ) ;

    t i t l e( ' FFT of f i l t ered s i gnal f romf i l ter one' ) ;

    subpl ot (5, 1, 4), pl ot( F,abs(hl )) ; xl i m([ 0 Fs/ 2] ) ;

    t i t l e( ' Frequency r esponse of Fi l t er Two' ) ;

    subpl ot ( 5, 1, 5) , pl ot ( F, abs( f f t ( yl ) ) ) ; xl i m([ 0 Fs /2] ) ;

    t i t l e( ' FFT of f i l t ered s i gnal f romf i l ter t wo' ) ;

    xl abel ( ' Hz . ' )

    % Pol e Zer o Const el l at i ons

    [ bh, ah] = eqt f l engt h( bh, ah) ;

    [ zh, ph, kh] = t f 2zp( bh, ah) ;

    [bl , al ] = eqt f l ength(bl , al ) ;

    [ z l , pl , kl ] = t f 2zp(bl , al ) ;

    f i gure,

    subpl ot (1, 2, 1), zpl ane(bh, ah) ; xl i m( [- 1. 5 1. 5] ) ; yl i m([ - 1. 5 1. 5]) ;

    t i t l e( ' Fi l t er One' ) ;

    subpl ot (1, 2, 2), zpl ane(bl , al ) ; xl i m( [- 1. 5 1. 5] ) ; yl i m([ - 1. 5 1. 5]) ;

    t i t l e( ' Fi l t er Two' ) ;

    4.

    Note the observations from frequency response, pole-zero constellation.

    5. Compare plots across FIR and IIR.

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    24/37

    Digital Signal Processing Lab session 09NED University of Engineering and Technology Department of Electrical Engineering

    - 22 -

    LAB SESSION 09

    Generation of sine waves using lookup table using C-6713

    DSK

    OBJECTIVE:

    To generate a sinusoid and plotting it with Code Composer Studio (sine8_buf).

    REQUIREMENTS:

    C6713 DSK(DSP Starter Kit) and its support tools

    Oscilloscope

    Head phones/ Speaker

    THEORY:

    This exercise generates a sinusoid with eight points. More important, it illustrates

    CCS capabilities for plotting in both time and frequency domains. The program used

    in this exercise creates a buffer to store the output data in memory.

    Buffer:

    Buffer is an array in which data to be written or to be read from the disk is placed.

    Putting the contents of a file in a buffer has certain advantages; we can perform

    various operations on the contents of buffer without having to access the file again.

    The size of the buffer is important for efficient operation. Depending on the operatingsystem, buffers of certain sizes are handled more efficiently than others. In this

    program, an output buffer is created to capture a total of 256 sine data values.

    Interrupt:

    An interrupt can be issued internally or externally. An interrupt stops the current CPU

    process so that it can perform a required task initiated by the interrupt. The source of

    the interrupt can be an ADC, timer etc. On an interrupt; the conditions of the current

    process must be saved so that they can be restored after the interrupt task is

    performed.

    PROCEDURE:

    1. Connect DSK C6713 board to the USB port of PC and give +5V supply to the

    board.

    2. Perform the diagnostic and quick tests of DSK (refer to Appendix A).

    3. Connect the DSK by selecting Debug Connect, if it has not already been

    connected.

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    25/37

    Digital Signal Processing Lab session 09NED University of Engineering and Technology Department of Electrical Engineering

    - 23 -

    4. Create New Project (refer to Appendix B).5.Add files to the project (refer to

    Appendix C).

    6. Bulid the program (refer to Appendix D).

    7. Select FileLoad Program in order to load sine_buf.out on the DSK.

    8. Connect a speaker to the LINE OUT connector on the DSK

    9. Select DebugRun.

    OBSERVATION:

    A tone of 1 kHz can be heard on speaker or can be viewed on an oscilloscope.

    EXERCISE:

    Plotting with Code Composer Studio (CCS):

    To plot the current output data stored in the buffer using CCS, perform following

    steps:

    1. Select View Graph Time/Frequency. Change the Graph Property Dialog so

    that the options in Figure 2.1 are selected for a time-domain plot. The other options

    can be left as default. Press OK and observe the wave pattern in time-domain

    within CCS.

    2. Now change CCS Graph Property Dialog for a frequency-domain plot according to

    Figure 2.2. Press OK and observe the FFT magnitude plot. The spike at 1000Hz

    represents the frequency of the sinusoid generated.

    Display Type Single Time

    Graph Title Graphical Display

    Start Address out_buffer

    Acquisition Buffer Size 256

    Index Increment 1

    Display Data Size 64

    DSP Data Type 16-bit signed integer

    Q-value 0

    Sampling Rate (Hz) 8000

    Plot Data From Left to Right

    Left-shifted Data Display Yes

    Autoscale On

    DC Value 0Axes Display On

    Time Display Unit S

    Status Bar Display On

    Figure 2.1

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    26/37

    Digital Signal Processing Lab session 09NED University of Engineering and Technology Department of Electrical Engineering

    - 24 -

    Display Type FFT Magnitude

    Graph Title Graphical Display

    Signal Type Real

    Start Address out_buffer

    Acquisition Buffer Size 256

    Index Increment 1

    FFT Frame Size 256

    FFT Order 8

    FFT Windowing Function Rectangle

    Display Peak and Hold Off

    DSP Data Type 16-bit signed integer

    Q-value 0

    Sampling Rate (Hz) 8000

    Plot Data From Left to Right

    Left-shifted Data Display Yes

    Autoscale On

    Figure 2.2

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    27/37

    Digital Signal Processing Lab session 10NED University of Engineering and Technology Department of Electrical Engineering

    - 25 -

    LAB SESSION 10

    Generation of sine waves using interrupts

    OBJECTIVE:

    To illustrate a Loop Program using interrupt (loop_intr).

    REQUIREMENTS:

    C6713 DSK(DSP Starter Kit) and its support tools

    Oscilloscope

    Function Generator

    Head phones/ Speaker

    THEORY:

    This lab session illustrates input and output with the codec. This program example is

    very important since it can be used as a base program to build on. For example, to

    implement a digital filter, one would need to insert the appropriate algorithm between

    the input and output functions. An interrupt occurs every sample period Ts=1/Fs at

    which time an input sample value is read from the codecs ADC and then sent as

    output to the codecs DAC.

    Interrupt:

    An interrupt can be issued internally or externally. An interrupt stops the current CPUprocess so that it can perform a required task initiated by the interrupt. The source of

    the interrupt can be an ADC, timer etc. On an interrupt; the conditions of the current

    process must be saved so that they can be restored after the interrupt task is

    performed.

    Loop:

    We frequently need to perform an action over and over, often with variations in the

    details each time. The mechanism that meets this need is the loop. In programming,

    it is often the case that you want to do something a fixed number of times. The loop is

    ideally suited for such cases. There are three major loop structures in C: the for

    loop, the while loop and the do whileloop. The program in this exercise uses whileloop

    PROCEDURE:

    1. Connect DSK C6713 board to the USB port of PC and give +5V supply to the

    board.

    2. Perform the diagnostic and quick tests of DSK (refer to Appendix A).

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    28/37

    Digital Signal Processing Lab session 10NED University of Engineering and Technology Department of Electrical Engineering

    - 26 -

    3. Connect the DSK by selecting Debug Connect, if it has not already been

    connected.

    4. Create New Project (refer to Appendix B).

    5. Add files to the project (refer to Appendix C).

    6. Build the program (refer to Appendix D).

    7. Select FileLoad Program in order to load loop_intr.out on the DSK.8. Input a sinusoidal waveform to the LINE IN connector on the DSK with an

    amplitude of approximately 2V p-p and a frequency between approximately 1and 3

    kHz.

    9. Select DebugRun.

    OBSERVATION:

    A tone of same input frequency, but attenuated to approximately 0.8V p-p, can be

    heard on speaker or can be viewed on an oscilloscope connected to the LINE OUT

    connector of the DSK.

    EXERCISE:

    Increase the amplitude of the input sinusoidal waveform beyond 6V p-p and observe

    that the output signal becomes distorted. This is because; the maximum level of the

    input signal to the codec is 6 Vp-p.

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    29/37

    Digital Signal Processing Lab session 11NED University of Engineering and Technology Department of Electrical Engineering

    - 27 -

    LAB SESSION 11

    Computation of DFT using FFT Algorithms in C -6713 DSK

    OBJECTIVE:

    To compute DFT of a sequence of real Numbers with Output from the CCS Window

    (DFT).

    REQUIREMENT:

    1. C6713 DSK(DSP Starter Kit) and its support tools

    2.

    Oscilloscope3.

    Function Generator

    THEORY:

    The DFT converts a time - domain sequence into an equivalent frequency domain sequence.

    The inverse DFT performs the reverse operation and converts a frequency - domain sequenceinto an equivalent time - domain sequence. The FFT is a very efficient algorithm technique

    based on the DFT but with fewer computations required. The FFT is one of the most

    commonly used operations in digital signal processing to provide a frequency spectrum

    analysis.

    PROCEDURE:

    1. Connect DSK C6713 board to the USB port of PC and give +5V supply to the board.2. Perform the diagnostic and quick tests of DSK (refer to Appendix A).

    3. Connect the DSK by selecting DebugConnect, if it has not already been connected.4. Create New Project (refer to Appendix B).

    5. Add files to the project (refer to Appendix C).6. Build this project as DFT (refer to Appendix D). The input x(n) is a cosine with N=8 data

    points. To test the results, load the program.

    7. Select view, Watch Window and insert the two expressions j and out(right click on the

    Watch window). Click on +out to expand and view out[0] and out[1], which represent thereal and imaginary components respectively.

    8.

    Place a break point at the bracket } that follows the DFT function call.

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    30/37

    Digital Signal Processing Lab session 11NED University of Engineering and Technology Department of Electrical Engineering

    - 28 -

    OBSERVATION:

    1.

    Select Debug, Animate(Animation speed can be controlled through j=1 and at j=7, while

    small otherwise. Since x(n) is a one-cycle sequence, m=1. Since the number of points is

    N=8, a spike occurs at j=m=1 used to verify these results.

    2.

    Note that the data values in the table are rounded (yielding a spike with a maximum valueof 3996 in lieu of 4000). Since it is a cosine, the imaginary component out[1] is

    zero(small). In a real time implementation, with Fs=8KHz, the frequency generated wouldbe at f=Fs(number of cycles)/N=1KHz.

    EXERCISE:

    Use the two-cycle sine data table (in the program) with 20 points as input x (n). Within the

    program, change N to 20, comment the table that corresponds to the cosine (first input), andinstead use the sine table values. Rebuild and animate again. Verify a large negative value at

    j=N-m=18 (10,232). For a real time implementation, the magnitude of X (k), k=0,1,. can be

    found. With Fs=8 KHz, the frequency generated would corresponds to f=800 Hz.

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    31/37

    Digital Signal Processing Lab session 12NED University of Engineering and Technology Department of Electrical Engineering

    - 29 -

    LAB SESSION 12

    Designing FIR Filter using C-6713 DSK

    OBJECTIVE:

    FIR Filter implementation: Bandstop centered at 2700Hz (FIR).

    REQUIREMENTS:

    1. C6713 DSK(DSP Starter Kit) and its support tools

    2. Oscilloscope3.

    Function Generator

    THEORY:

    A digital filter operates on discrete time signals ad can be implemented with a digital signal

    processor.. This involves the use of an ADC to capture an external input signal, processingthe input samples, and sending the resulting output through a DAC.

    Digital filters are more reliable, accurate and less sensitive to temperature and aging.

    Stringent magnitude and phase characteristics can be achieved with a digital filter. Also filer

    characteristics such as centre frequency, bandwidth ad filter type can readily be modified canreadily be modified transform is utilized for the analysis of discrete time signals, similar to the

    Laplace transform for continuous time signals.

    PROCEDURE:

    1. Connect DSK C6713 board to the USB port of PC and give +5V supply to the board.2. Perform the diagnostic and quick tests of DSK (refer to Appendix A).

    3. Connect the DSK by selecting DebugConnect, if it has not already been connected.

    4. Create New Project (refer to Appendix B).

    5. Add files to the project (refer to Appendix C).6. Build the program (refer to Appendix D).

    7. Select FileLoad Program in order to load FIR.out on the DSK8. Input a sinusoidal signal and vary the input frequency slightly below and above 2700 Hz.

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    32/37

    Digital Signal Processing Lab session 12NED University of Engineering and Technology Department of Electrical Engineering

    - 30 -

    OBSERVATION:

    Verify that the output of bandstop filter is a minimum at 2700Hz.

    EXERCISE:

    Within CCS, edit the program FIR.c to include the coefficient file bp1750.cof in lieu of

    bs2700.cof. The file bp1750.cof represent an FIR bandpass filter centered at 1750 Hz.

    The coefficients can be obtained from FDA tool of MATLAB.

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    33/37

    Digital Signal Processing AppendicesNED University of Engineering and Technology Department of Electrical Engineering

    - 31 -

    APPENDICES

    1. In debug options select connect. A message will appear that the target is now connected.2. Creating new project.

    To create the project file sine8_buff, select Project, New. Type sine8_buf for the projectname, as shown in figure 2. This project file is saved in the folder sine8_buf (within

    C:\CCStudio_v3.1\MyProjects). In target field select TMS320C67XX. Click Finish.

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    34/37

    Digital Signal Processing AppendicesNED University of Engineering and Technology Department of Electrical Engineering

    - 32 -

    3.

    Adding files to the project. Go to Project, add files to project and do the following:

    (a) Look in CCStudio_v3.1. Select folder C6000, change the file of type to All Files and addthe following files:(i) Select cgtools, lib, rts6700 and click open.(ii)Select csl, lib, csl6713 and

    click open.(iii)Select dsk6713, lib, dsk6713bsl and click open.

    (b)Look in Desktop, select folder CCS C6713 Digital Signal codes.

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    35/37

    Digital Signal Processing AppendicesNED University of Engineering and Technology Department of Electrical Engineering

    - 33 -

    (i) Select folder Support and add the following files (i)C6713dsk (ii)C6713dskinit[Type Cfile not ASM or H file].(iii)Select Vectors_intr or Vectors_poll according to the requirement

    of the code. In our program its Vectors_intr.

    (ii) Select sine8_buf folder and then select sine8_buf type C file.

    4. Building Program.

    Building the program:

    (a) Go to project and then build options.(i)

    In compiler options Basic settings, remove the location from dollar sign to

    DEBUG and then in quotation marks write the location of sine8_buf i.e

    C:\CCStudio_v3.1\MyProjects\sine8_buf.

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    36/37

    Digital Signal Processing AppendicesNED University of Engineering and Technology Department of Electrical Engineering

    - 34 -

    (ii)

    In Compiler option Advanced settings change the memory mmodel field to Far{--

    mem_model:data=far}.

    (iii) In Compiler option Preprocessor settings:(a)

    In Pre-Define Symbol {-d}, write CHIP_6713.

    (b)

    In Include Search Path{-i}, write C:\CCStudio_v3.1\C6000\dsk6713\include.

  • 8/10/2019 EE-493 Digital Signal Processing _ 2013

    37/37

    Digital Signal Processing AppendicesNED University of Engineering and Technology Department of Electrical Engineering

    (iv) In linker Option delete top field from m to before -0. Delete w as well.

    (b)Press OK at the end.

    (c)Press Build Clean in project.

    (d)Finally press Build to build the program.

    To open the code go to File, Open, Look in sine8_buf and open sine8_buf C type file.