CE00039_2_cwk_0809

Embed Size (px)

Citation preview

  • 7/28/2019 CE00039_2_cwk_0809

    1/11

    MNP/CE00039-2/Signal Processing / Sem1 2008

    1

    Faculty of Engineering & Advanced

    Technology

    Signal Processing

    CE00039-2

    LABORATORY ASSIGNMENT

    Module Tutors:

    Dr Alison Carrington & Dr Mohammad Patwary

  • 7/28/2019 CE00039_2_cwk_0809

    2/11

    MNP/CE00039-2/Signal Processing / Sem1 2008

    2

    GENERAL INTRODUCTION

    Introduction

    Three laboratory assignments are presented in this document. These laboratory based

    assignments are weighted as 50% of the overall mark for the module. The final examination

    is weighted as 50%.

    Module Learning Outcomes

    Learning Outcome

    1. Demonstrate fundamental understanding of Signal Processing.Knowledge &

    Understanding

    2. Apply appropriate analytical techniques to critically evaluate signals and

    their processing

    Analysis

    Learning

    3. Use simulation models and the key analytical skills to critically evaluate

    results and relate them to theory.Application

    4. Communicate Ideas Effectively. Communication

    The laboratory based assignments will assess learning outcomes 3 and 4 and based on a

    Formal Report including Background Research, Data Analysis, Discussion &

    Recommendations, and Matlab model and simulation.

    The criteria and formats are explained later in this document.

    Marks allocation and feedback sheets are attached at the end of this document. Copies should

    be attached to your work. Students are expected to present a detailed analysis of results and

    comparison with theory.

  • 7/28/2019 CE00039_2_cwk_0809

    3/11

    MNP/CE00039-2/Signal Processing / Sem1 2008

    3

    General Objective

    The aim of this assignment is to allow the student to develop an in-depth understanding of the

    technical components of a Analogue and Digital signal processing.

    For guidance throughout the assignment, see your module tutor, Dr Alison Griffiths or Dr

    Mohammad Patwary.

    Assessment Criteria

    Laboratory Log Book (optional)

    Maintaining a useful laboratory log book is an important skill and should:

    a) be an accurate record of the work done and the results;

    b) give traceability for the work done;

    c) form the basis of any report which may be written subsequently, ie it should be a clear,

    stand alone record, with comments and a brief conclusion, from which any report could

    easily be written without having to repeat any of the work;

    d) be written up while you are in the laboratory, ie within the 3 hour session, not from bitsof paper after you have left the laboratory; this only wastes your time;

    The laboratory log book should be a bound A4 notebook or a loose leaf binder. You are

    expected to provide your own log book and graph paper etc.

    The front page should show:

    YOUR NAME

    MODULE CODE and TITLE

    LECTURER'S NAME

    LABORATORY SUPERVISOR'S NAME

    Each laboratory assignment should be headed with :

    DATE - on which the work was done,

    TITLE - of the assignment,

    NAMES - your name and names of the people present in your sub-group for that

    assignment.

    Laboratory sheets should be inserted, stapled in if necessary. Log book entries should be

    clear, concise and legible.

    It will be useful if you store your exercise models, as they can be used in this assignment.

    Handing-In Dates

    Final submission deadlines are shown on the assignment front sheet attached to this

    assignment. Laboratory sessions will be on a timetabled rota with all sessions completed by

    the end of week 11 (normally). The majority of the log book record should be written up

    while you are in the laboratory. The formal report may be handed-in as soon as you have

    written it, along with the log book, but no later than the final submission deadlines given.

  • 7/28/2019 CE00039_2_cwk_0809

    4/11

    MNP/CE00039-2/Signal Processing / Sem1 2008

    4

    Work handed in after the set deadlines is not acceptable and will be awarded zero marks. If

    there is a valid reason for late submission, the procedure for extenuating circumstances must

    be followed which includes the requirement for documentary evidence (eg a medical

    certificate if illness was the reason). See your student handbook. Extenuating Circumstances

    claim forms may be obtained from the Faculty Office. The work may be accepted if the

    reason is considered to be sufficient justification.

    Work submitted for assessment which is not your own work (i.e. copied) will be disqualified

    and awarded zero marks.

    Assignment Front Sheet

    A standard assignment front sheet is attached, this must be attached to the front of your work

    andmust be easily visible to the administration staff and the module tutors.

  • 7/28/2019 CE00039_2_cwk_0809

    5/11

    MNP/CE00039-2/Signal Processing / Sem1 2008

    5

    Faculty of Computing, Engineering and Technology

    Module Name: Signal Processing

    Module Number : CE00039-2Title of Assignment : Analogue to Digital and Digital to Analogue conversion of signals

    andMatlab SimulationModule Learning Outcomes for This Assignment

    1. Demonstrate critical understanding of signal processing Knowledge andUnderstanding

    2. Apply appropriate analytical techniques to critically evaluate signals andtheir processing

    Analysis

    3. Use equipment and simulation models and the analytic skills to criticallyevaluate results and relate them to theory.

    Application

    4. Communicate ideas effectively. Communication

    Hand in deadline : 16th

    December 2008

    Assignment descriptionImplement your solution using MATLAB. A formal report should explain and justify your design and results

    obtained. Include m-files as an appendix to the main report. Reference all information sources.

    % of

    mark

    Criterion Unsatisfactory Threshold Good Excellent

    25 Research ideas

    and concepts

    using a variety ofinformation

    sources

    Little relevant

    research. Few

    items referenced.Poor

    understanding of

    the topic

    Research

    information

    related to theproblem domain

    Research and

    evaluate

    informationrelated to the

    problem domain

    Initiate and

    undertake searches

    for informationrelated to the

    problem domain,

    evaluate it andrecommend

    actions based on

    the information

    25 Design the

    required solution

    Incomplete

    methodology.

    Poor

    understanding ofthe problem

    Design using

    routine

    techniques

    Design to fulfill

    the specified

    requirement

    Innovative design

    to fulfill the

    specified

    requirement

    35 Use MATLAB to

    implement the

    solution

    Poor or

    inappropriate use

    of MATLAB

    Use MATLAB to

    implement an

    algorithmrelevant to theproblem

    Use MATLAB to

    implement the

    design solution

    Use MATLAB to

    implement the

    design solution,analyse andevaluate its use

    15 Effective written

    communication

    Poor reporting,

    unstructured, little

    communication of

    technicalinformation

    Clear

    communication of

    technicalinformation

    Coherent

    communication

    using technicallanguage

    accurately

    Professional

    presentation using

    technical languagefluently

    Table 1- Assessment Criteria

  • 7/28/2019 CE00039_2_cwk_0809

    6/11

    MNP/CE00039-2/Signal Processing / Sem1 2008

    6

    INTRODUCTION

    This laboratory uses the simulation package, MatlabTM

    and SimulinkTM

    .

    Quantizing a Signal

    This section shows how theQuantizing Encoderand Quantizing Decoderblocks use the partition andcodebook parameters.

    Scalar Quantization Example 1

    The figure below shows how theQuantizing Encoderblock uses the partition and codebook asdefined above to map a real vector to a new vector whose entries are either -1, 0.5, 2, or 3. In theScope window, the bottom signal is the quantization of the (original) top signal.

    To build the model, gather and configure these blocks:

    Signal From Workspace,

    in the Signal P rocessing Blockset DSP Sources library. The output signal samples obtained from theMATLAB workspace at successive sample times. A signal matrix is interpreted as having onechannel per column. Signal columns be buffered into frames by sepecfiying a number of sample perframe greater than 1.

  • 7/28/2019 CE00039_2_cwk_0809

    7/11

    MNP/CE00039-2/Signal Processing / Sem1 2008

    7

    SetSignal to [-2.4,-1,-.2,0,.2,1,1.2,1.9,2,2.9,3,3.5]'.

    Quantizing Encoder

    The Quantizing Encoder block quantizes the input signal according to the Partition vector and

    encodes the input signal according to the Codebook vector. The input signal can be either a scalar ora vector. This block processes each vector element independently.

    The first output is the quantization index. The second output is the quantized signal. The values forthe quantized signal are taken from the Codebook vector.

    The Quantization partition parameter, P, is a real vector of length n whose entries are in strictlyascending order.

    The Quantization codebook parameter, whose length is n+1, prescribes a value for each partition inthe quantization. The first element of Quantization codebook is the value for the interval betweennegative infinity and the first element of P. The second output signal from this block contains thequantization of the input signal based on the quantization indices and prescribed values.

    You can use the function lloyds in the Communications Toolbox with a representative sample of yourdata as training data, to obtain appropriate partition and codebook parameters

    SetQuantization partition to [ 0, 1, 3] .

    SetQuantization codebook to [ - 1, 0. 5, 2, 3] .

    Terminator

    In the Simulink Sinks library. The Terminator block can be used to cap blocks whose output ports arenot connected to other blocks. If you run a simulation with blocks having unconnected output ports,Simulink issues warning messages. Using Terminator blocks to cap those blocks avoids warningmessages

  • 7/28/2019 CE00039_2_cwk_0809

    8/11

    MNP/CE00039-2/Signal Processing / Sem1 2008

    8

    Scope In the Simulink Sinks library

    o After double-clicking the block to open it, click theParameters icon and setNumberof axes to 2.

    Connect the blocks as shown in the figure. Also, from the model window's Simulation menu, chooseConfiguration parameters; then in the Configuration Parameters dialog box, set Stop time to 12.Running the model produces a scope image similar to the one above. (To make the axis ranges andtitle exactly match those in the figure, right-click each plot area in the scope and selectAxesproperties.)

    Scalar Quantization Example 2

    This example, shown in the figure below, illustrates the nature of scalar quantization more clearly. Itsamples and quantizes a sine wave and then plots the original (top) and quantized (bottom) signals.The plot contrasts the smooth sine curve with the polygonal curve of the quantized signal. The verticalcoordinate of each flat part of the polygonal curve is a value in theQuantization codebook vector.

    To open the completed model, clickhere in the MATLAB Help browser. To build the model, gatherand configure these blocks:

    Sine Wave, in the Simulink Sources library (not the Sine Wave block in the Signal ProcessingBlockset DSP Sources library)

  • 7/28/2019 CE00039_2_cwk_0809

    9/11

    MNP/CE00039-2/Signal Processing / Sem1 2008

    9

    Zero-Order Hold, in the Simulink Discrete library.

    The Zero-Order Hold block samples and holds its input for the specified sample period. Theblock accepts one input and generates one output, both of which can be scalar or vector. Ifthe input is a vector, all elements of the vector are held for the same sample period.

    You specify the time between samples with the Sample time parameter. A setting of -1 meansthe Sample time is inherited.

    This block provides a mechanism for discretizing one or more signals in time, or resamplingthe signal at a different rate. If your model contains multirate transitions, you must add Zero-Order Hold blocks between the fast-to-slow transitions. The sample rate of the Zero-OrderHold must be set to that of the slower block. For slow-to-fast transitions, use the Unit Delayblock. For more information about multirate transitions, refer to the Simulink or the Real-TimeWorkshop documentation.

    o SetSample time to 0. 1.

    Quantizing Encoder

    o SetQuantization partition to [ - 1: . 2: 1] .

    o SetQuantization codebook to [ - 1. 1: . 2: 1. 1] .

    Terminator, in the Simulink Sinks library

    Scope, in the Simulink Sinks library

    o After double-clicking the block to open it, click theParameters icon and setNumberof axes to 2.

    Connect the blocks as shown in the figure. Also, from the model window's Simulation menu, chooseConfiguration parameters; then in the Configuration Parameters dialog box, set Stop time to2*pi . Running the model produces the scope image as shown above. (To make the axis ranges andtitle exactly match those in the figure, right-click each plot area in the scope and selectAxesproperties.)

    Determining Which Interval Each Input Is in

    The Quantizing Encoder block also returns a signal, at the first output port, that tells which intervaleach input is in. For example, the model below shows that the input entries lie within the intervals

    labeled 0, 6, and 5, respectively. Here, the 0th interval consists of real numbers less than or equal to3; the 6th interval consists of real numbers greater than 8 but less than or equal to 9; and the 5thinterval consists of real numbers greater than 7 but less than or equal to 8.

    To open the completed model, click here in the MATLAB Help browser. To build the model, gatherand configure these blocks:

    Constant, in the Simulink Sources library

    o SetConstant value to [ 2, 9, 8] .

    Quantizing Encoder

    o SetQuantization partition to [ 3, 4, 5, 6, 7, 8, 9] .

    o SetQuantization codebook to any vector whose length exceeds the length ofQuantization Partition by one.

    Terminator, in the Simulink Sinks library

  • 7/28/2019 CE00039_2_cwk_0809

    10/11

    MNP/CE00039-2/Signal Processing / Sem1 2008

    10

    Display, in the Simulink Sinks library

    o Drag the bottom edge of the icon to make the display big enough for three entries.

    Connect the blocks as shown above. Also, from the model window's Simulation menu, chooseConfiguration parameters; then in the Configuration Parameters dialog box, set Stop time to 10.Running the model produces the display numbers as shown in the figure.

    You can continue this example by branching the first output of the Quantizing Encoder block,connecting one branch to the input port of theQuantizing Decoderblock, and connecting the output ofthe Quantizing Decoder block to another Display block. If the two source coding blocks'Quantizationcodebook parameters match, then the output of the Quantizing Decoder block will be the same asthe second output of the Quantizing Encoder block. Thus the Quantizing Decoder block partiallyduplicates the functionality of the Quantizing Encoder block, but requires different input data andfewer.

    Assignment Problem set 1:

    Construct the following model

    Quantizing Encoder (8 levels):

    o SetQuantization partition to [ 0. 5, 1. 5, 2. 5, 3. 5, 4. 5, 5. 5, 6. 5] .

    o SetQuantization codebook to [ 0, 1, 2, 3, 4, 5, 6, 7] .

    You are required to:

    Develop the specified model Simulate the performance of the model in Matlab Simulink

    Construct and analyze the model for different quantization levels (4, 8, and 16)

    Plot the quantization error for different quantization levels Calculate the theoretical performance and compare

  • 7/28/2019 CE00039_2_cwk_0809

    11/11

    MNP/CE00039-2/Signal Processing / Sem1 2008

    11

    Assignment Problem set 2:

    An analogue cosine signal of frequency 50Hz is given by A=cos(2*3.14*50*t). Consider a

    signal time span of 0.50sec and sampling frequency of 1000Hz during analogue to digital

    conversion of the signal.

    You are required to:

    Generate the given analogue signal with Matlab script and plot it.

    Using Matlab script, convert the discrete time signal into digital considering 8quantization levels.

    Generate bar charts for all digitized bits within one figure window. ( plot MSB chartfirst).

    Using Matlab script, reconstruct the analogue signal from the digital signals.

    Using Matlab script, estimate the quantization error.

    Generate a figure that will compare the given analogue signal, reconstructed signaland the quantization error.

    Assignment Outcomes

    Section 1:

    Write a standard technical report (of around but not limited to 1500 words), to outline your

    research findings and outline your recommendations.

    Section 2:

    Print out the complete Simulink model and Matlab code is to be electronically submitted, i.e.

    on a CD.

    Submission Format

    The report structure is to include: Abstract, Contents, Introduction, Research, Theory,

    Simulation, Results, Discussion, Conclusion and References. A second copy of the report is

    to be electronically submitted on a CD.