Top Banner

of 19

Final Dsp Manual

Apr 07, 2018

Download

Documents

Mamta Kamath
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 8/3/2019 Final Dsp Manual

    1/19

    1

    Experiment No: 1

    BASIC OPERATIONS ON MATRICES

    AIM: To write a MATLAB program to perform some basic operation on matrices such as addition,

    subtraction, multiplication and inverse of a matrix.

    SOFTWARE REQURIED:

    MATLAB R2009a (7.8.0 Version).

    THEORY:

    Matlab stands for MATrix LABoratory, and was originally written to perform matrix algebra. It is very

    efficient at doing this, as well as having the capabilities of any normal programming language. Inmost instances, the data we will be dealing with are simple matrices, either single values, or one- or

    two dimensional arrays. An example of a one dimensional array (vector) is a single row or a single

    column of values.

    The following matrix operations can be performed with very ease in MATLAB.

    Consider the two matrices:

    a=[1 2 -9 ; 2 -1 2; 3 -4 3]; and b=[1 2 3; 4 5 6; 7 8 9];

    i. Addition>>c=a+b

    c =

    2 4 -6

    6 4 8

    10 4 12

    ii. Subtraction>>d=a-b

    d =

    0 0 -12

    -2 -6 -4

    -4 -12 -6

  • 8/3/2019 Final Dsp Manual

    2/19

    2

    iii. Multiplication>>e=a*b

    e =

    -54 -60 -66

    12 15 18

    8 10 12

    iv. Inverse>>f=inv(a)

    f =

    0.1000 0.6000 -0.1000

    0 0.6000 -0.4000

    -0.1000 0.2000 -0.1000

    CONCLUSION:

    Thus we have studied the computations on matrices using MATLAB.

  • 8/3/2019 Final Dsp Manual

    3/19

    3

    Experiment No: 2

    REALISATION OF SIGNALS

    Aim: To write a MATLAB program to generate discrete time and continuous time signals like unit

    impulse, unit step, unit ramp, exponential signal and sinusoidal signals.

    SOFTWARE REQURIED:

    MATLAB R2009a (7.8.0 Version).

    Theory: In the analysis of communication systems, standard test signals play a vital role. Such

    signals are used to check the performance of a system. Mathematically, a signal is described as a

    function of one or more independent variables. It is a physical quantity which varies with some

    dependent or independent variables. The signals can be basically either continuous time or discrete

    time signals. Continuous time signals are analog signals having some value at every instant of time.

    Discrete time signals are represented at discrete intervals of time i.e. they have a specific value at

    specific time.

    Some standard test signals are as follows:

    Unit Impulse Signal: A discrete time unit impulse function is denoted by (n). Its amplitude is 1 at

    n=0 and for all other values of n; its amplitude is zero.

    (n)=1; for n=0

    =0; for n0

    Discrete Unit Impulse Signal

  • 8/3/2019 Final Dsp Manual

    4/19

    4

    A continuous time unit impulse function is denoted by (t). Mathematically it is expressed as:

    (t)=0; for t0

    Continuous Unit Impulse Signal

    Unit Step signal: A discrete time unit step signal is denoted by u(n). Its value is unity for n0 while

    for other values of n its value is zero.

    u(n)=1; for n0

    =0; for n

  • 8/3/2019 Final Dsp Manual

    5/19

    5

    Unit ramp Signal: A discrete time unit ramp signal is denoted by u r(n). Its value increases linearly

    with sample number n.

    ur(n)=n; for n0

    =0; for n

  • 8/3/2019 Final Dsp Manual

    6/19

    6

    x(n)=A sin wn, where A = amplitude

    w=Angular

    frequency

    A continuous time sinusoidal signal is denoted by:

    x(t)=A sin wt, where A = amplitude

    w=Angular

    frequency

    Conclusion: Thus the Generation of discrete time and continuous time signals like unit impulse, unit

    step, unit ramp, exponential signal and sinusoidal signals is successfully completed.

  • 8/3/2019 Final Dsp Manual

    7/19

    7

    Experiment No: 3

    OPERATIONS ON SIGNALS AND SEQUENCES

    Aim: To write a MATLAB program to perform various operations on signals such as addition,

    multiplication, scaling, shifting and folding.

    SOFTWARE REQURIED:

    MATLAB R2009a (7.8.0 Version).

    Theory: Many a times it is necessary to modify the original signal. This modification is achieved by

    performing different operations on given discrete time signal. These operations can be briefly

    explained as follows:

    Addition: Consider two sequences:

    x1(n) = [1, 1, 0, 1,1] and x2(n) = [2, 2, 0, 2, 2]

    Let y(n) = x1(n) + x2(n)

    y(n) = [3, 3, 0, 3, 3]

    Multiplication:

    Scaling:

    Shifting:

    Folding:

    Some standard test signals are as follows:

    Unit Impulse Signal: A discrete time unit impulse function is denoted by (n). Its amplitude is 1 at

    n=0 and for all other values of n; its amplitude is zero.

    (n)=1; for n=0

    =0; for n0

    Discrete Unit Impulse Signal

  • 8/3/2019 Final Dsp Manual

    8/19

    8

    A continuous time unit impulse function is denoted by (t). Mathematically it is expressed as:

    (t)=0; for t0

    Continuous Unit Impulse Signal

    Unit Step signal: A discrete time unit step signal is denoted by u(n). Its value is unity for n0 while

    for other values of n its value is zero.

    u(n)=1; for n0

    =0; for n

  • 8/3/2019 Final Dsp Manual

    9/19

    9

    Continuous Unit Step Signal

    Unit ramp Signal: A discrete time unit ramp signal is denoted by u r(n). Its value increases linearly

    with sample number n.

    ur(n)=n; for n0

    =0; for n

  • 8/3/2019 Final Dsp Manual

    10/19

    10

    A continuous time exponential signal is expressed as:

    x(t)=at, where a is some real constant

    Sinusoidal Signal: A discrete time sinusoidal signal is denoted by:

    x(n)=A sin wn, where A = amplitude

    w=Angular

    frequency

    A continuous time sinusoidal signal is denoted by:

    x(t)=A sin wt, where A = amplitude

    w=Angular

    frequency

    Conclusion: Thus the Generation of discrete time and continuous time signals like unit impulse, unit

    step, unit ramp, exponential signal and sinusoidal signals is successfully completed.

    Experiment No: 2

    SAMPLING THEOREM

    AIM: To generate a MATLAB Program to verify the sampling theorem.

    SOFTWARE REQURIED

    MATLAB R2006 (7.3 Version).

    THEORY:

    Example:

    x=cos(2*pi*f1*t)+cos(2*pi*f2*t);f1=3;

  • 8/3/2019 Final Dsp Manual

    11/19

    11

    f2=23;

    %case 1: (fs2fm)

    Output:

    CONCLUSION:

    Thus we have studied the computations on matrices using MATLAB.

    Aim

    SOFTWARE REQURIED

  • 8/3/2019 Final Dsp Manual

    12/19

    12

    MATLAB R2009a (7.8.0 Version).

    Theory

    Example

    Functions

    Figures

    Conclusion

  • 8/3/2019 Final Dsp Manual

    13/19

    13

    Experiment No: 1

    LINEAR PHASE FIR FILTERS

    AIM: To write a MATLAB program:

    I. To check the linear phase condition and classify the given filter into type I, II, III and IVbased on the impulse response.

    II. To study the magnitude and phase responses of the filter.

    SOFTWARE REQURIED:

    MATLAB R2009a (7.8.0 Version).

    THEORY:

    A filter is supposed to operate with a definite pass band and a stop band. An ideal filter must have

    constant gain and a uniform delay for all the frequencies in the pass band. The group delay( p) is the

    derivative of the phase angle with respect to the frequency.

    The group delay becomes constant with respect to frequency if the phase angle happens to be linear

    function of the frequency. Hence linear phase filters can have uniform group delay. Linear phase

    property is exhibited only by FIR filters. An FIR filter has linear phase it its impulse response is either

    symmetric or anti symmetric. The nature of the pass band depends on filter length and its symmetry

    as shown below in the table.

    Filter Length and Symmetry Type Nature of Pass Band

    Symmetric with odd length I LP,HP,BP and BS

    Symmetric with even length II LP and BP

    Anti symmetric with odd length III BP

    Anti symmetric with even length IV HP and BP

    The magnitude and phase responses along with zero locations of such filters are investigated

    through a MATLAB program.

  • 8/3/2019 Final Dsp Manual

    14/19

    14

    MATLAB FUNCTIONS:

    fliplr():FLIPLR(X) returns X with row preserved and columns flipped in the left/right direction.

    X = 1 2 3 becomes 3 2 1

    4 5 6 6 5 4

    freqz():[H,W] = FREQZ(B,A,N) returns the N-point complex frequency response vector H and the N-

    point frequency vector W in radians/sample of a filter.

    zplane():ZPLANE(Z,P) plots the zeros Z and poles P (in column vectors) with the unit circle for

    reference.

    CONCLUSION:

    Thus the linear phase property of the FIR filter was verified. Also the zero locations at z=1 and z=-1

    for different types of filters was verified.

  • 8/3/2019 Final Dsp Manual

    15/19

    15

    Experiment No: 1

    TIME AND FREQUENCY DOMAIN BEHAVIOUR OF

    FIR WINDOW FUNCTIONS

    AIM: To write a MATLAB program:

    i. To study the time and frequency domain behaviour of different window functions usedin FIR filters.

    ii. To study the change in the parameter of the window in frequency domain w.r.t. thechange in the window length, using thefdatoolof MATLAB.

    SOFTWARE REQURIED:

    MATLAB R2009a (7.8.0 Version).

    THEORY:

    Windowing technique is one of the methods used for FIR filter design. An ideal filter function in the

    frequency domain gives infinitely stretching response in the time domain. This response is made

    finite by multiplying it with suitable window function. The response is made causal by shifting the

    required number of samples towards right. The different window functions along with their

    corresponding frequency responses are studied in this experiment. The shown below table shows

    the summary of window functions:

    M= Filter length

    No. Window Function

    1 Rectangular ;1nw n = 0 to M-1

    2 Triangular Bartlett ;

    1

    ||21

    M

    nnw 1|| Mn

    3 Hanning

    1

    **2cos1

    2

    1

    M

    npinw ; 1|| Mn

    4 Hamming ;

    1

    **2cos46.054.0

    M

    npinw 1|| Mn

    5 Blackman ;

    1

    **4cos08.0

    1

    **2cos5.042.0

    M

    npi

    M

    npinw 1|| Mn

  • 8/3/2019 Final Dsp Manual

    16/19

    16

    MATLAB FUNCTIONS:

    freqz():[H,W] = FREQZ(B,A,N) returns the N-point complex frequency response vector H and the N-

    point frequency vector W in radians/sample of a filter.

    abs():ABS(X) is the absolute value of the elements of X. When X is complex, ABS(X) is the complex

    modulus (magnitude) of the elements of X.

    fdatool:FDATOOL launches the Filter Design & Analysis Tool (FDATool). It is a Graphical User

    Interface (GUI) that allows you to design or import, and analyze digital FIR and IIR filters.

    CONCLUSION:

    Thus the time and frequency domain behaviour of different window functions were studied, along

    with the change in the parameters of the window in frequency domain w.r.t. the change in the

    window length, using thefdatoolof MATLAB.

  • 8/3/2019 Final Dsp Manual

    17/19

    17

    Experiment No: 1

    ANALOG IIR FILTERS

    AIM: To write a MATLAB program:

    i. To find the order of an analog filter for a given set of specifications using Butterworth,Chebyshev and Elliptical approximation methods.

    ii. To study the magnitude and phase responses of the filter.

    SOFTWARE REQURIED:

    MATLAB R2009a (7.8.0 Version).

    THEORY:The ideal response of an IIR filter may be approximated using different response functions. They are

    Butterworth, Chebyshev, Inverse Chebyshev and Elliptic approximations. For a given set of filter

    specifications, each of these approximations gives a different order of the filter. A comparative study

    of filter behaviour is carried out in this experiment by calculating the order of the individual filter for

    the same set of specifications.

    Butterworth Approximation:

    Order

    p

    s

    ww

    d

    d

    n

    log

    11

    11

    log

    2

    12

    1

    2

    2

    Chebyshev and Inverse Chebyshev Approximation:

    Order

    p

    s

    ww

    de

    n1

    21

    2

    2

    1

    cosh

    111

    cosh

    Where

    21

    2

    1

    11

    de

  • 8/3/2019 Final Dsp Manual

    18/19

    18

    Elliptic Approximation:

    Let

    p

    s

    w

    wk ;

    110

    1101.0

    1.0

    p

    s

    k

    k

    M

    22211

    161

    MMC ;

    121

    k

    kD

    Order DFCFn ee

    Where 92 152ln1 xxxpi

    XFe

    Alsopkd 1log20 ; skd 2log20

    MATLAB FUNCTIONS:

    buttord():[N, Wn] = BUTTORD(Wp, Ws, Rp, Rs) returns the order N of the lowest order digital

    Butterworth filter that loses no more than Rp dB in the passband and has at least Rs dB of

    attenuation in the stopband. Wp and Ws are the passband and stopband edge frequencies.

    cheb1ord():[N, Wp] = CHEB1ORD(Wp, Ws, Rp, Rs) returns the order N of the lowest order digital

    Chebyshev Type I filter that loses no more than Rp dB in the passband and has at least Rs dB

    of attenuation in the stopband. Wp and Ws are the passband and stopband edge

    frequencies.

    ellipord():[N, Wp] = ELLIPORD(Wp, Ws, Rp, Rs) returns the order N of the lowest order digital elliptic

    filter that loses no more than Rp dB in the passband and has at least Rs dB of attenuation in

    the stopband. Wp and Ws are the passband and stopband edge frequencies.

    round():ROUND(X) rounds the elements of X to the nearest integers.

    ceil():CEIL(X) rounds the elements of X to the nearest integers towards infinity.

  • 8/3/2019 Final Dsp Manual

    19/19

    19

    CONCLUSION:

    Thus for the given set of specifications, filter order was calculated for Butterworth, Chebyshev and

    Elliptic responses. It was also observed that the order of the filter increases with the decrease in

    transition width, increase in pass band gain and decrease in stop band gain.