You are on page 1of 11

Faculty of Engineering & Advanced Technology

Signal Processing CE00039-2 LABORATORY ASSIGNMENT

Module Tutors: Dr Alison Carrington & Dr Mohammad Patwary

MNP/CE00039-2/Signal Processing / Sem1 2008 1

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 Knowledge Understanding Analysis Learning &

1. Demonstrate fundamental understanding of Signal Processing.

2. Apply appropriate analytical techniques to critically evaluate signals and their processing

3. Use simulation models and the key analytical skills to critically evaluate Application results and relate them to theory. 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.

MNP/CE00039-2/Signal Processing / Sem1 2008 2

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 bits of 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.
MNP/CE00039-2/Signal Processing / Sem1 2008 3

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 and must be easily visible to the administration staff and the module tutors.

MNP/CE00039-2/Signal Processing / Sem1 2008 4

Faculty of Computing, Engineering and Technology

Module Name: Module Number : Title of Assignment :

Signal Processing CE00039-2

Analogue to Digital and Digital to Analogue conversion of signals and Matlab Simulation

Module Learning Outcomes for This Assignment

1. Demonstrate critical understanding of signal processing 2. Apply appropriate analytical techniques to critically evaluate signals and their processing 3. Use equipment and simulation models and the analytic skills to critically evaluate results and relate them to theory. 4. Communicate ideas effectively. Hand in deadline : 16th December 2008

Knowledge and Understanding Analysis Application

Communication

Assignment description Implement 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 25

Criterion Research ideas and concepts using a variety of information sources

Unsatisfactory Little relevant research. Few items referenced. Poor understanding of the topic

Threshold Research information related to the problem domain

Good Research and evaluate information related to the problem domain

Excellent Initiate and undertake searches for information related to the problem domain, evaluate it and recommend actions based on the information Innovative design to fulfill the specified requirement Use MATLAB to implement the design solution, analyse and evaluate its use Professional presentation using technical language fluently

25

Design the required solution

35

Use MATLAB to implement the solution

Incomplete methodology. Poor understanding of the problem Poor or inappropriate use of MATLAB

Design using routine techniques

Design to fulfill the specified requirement

15

Effective written communication

Coherent Poor reporting, communication unstructured, little using technical communication of language technical accurately information Table 1- Assessment Criteria

Use MATLAB to implement an algorithm relevant to the problem Clear communication of technical information

Use MATLAB to implement the design solution

MNP/CE00039-2/Signal Processing / Sem1 2008 5

INTRODUCTION This laboratory uses the simulation package, MatlabTM and SimulinkTM.

Quantizing a Signal
This section shows how the Quantizing Encoder and Quantizing Decoder blocks use the partition and codebook parameters.

Scalar Quantization Example 1


The figure below shows how the Quantizing Encoder block uses the partition and codebook as defined above to map a real vector to a new vector whose entries are either -1, 0.5, 2, or 3. In the Scope 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 Processing Blockset DSP Sources library. The output signal samples obtained from the MATLAB workspace at successive sample times. A signal matrix is interpreted as having one channel per column. Signal columns be buffered into frames by sepecfiying a number of sample per frame greater than 1. MNP/CE00039-2/Signal Processing / Sem1 2008 6

Set Signal 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 or a vector. This block processes each vector element independently. The first output is the quantization index. The second output is the quantized signal. The values for the quantized signal are taken from the Codebook vector. The Quantization partition parameter, P, is a real vector of length n whose entries are in strictly ascending order. The Quantization codebook parameter, whose length is n+1, prescribes a value for each partition in the quantization. The first element of Quantization codebook is the value for the interval between negative infinity and the first element of P. The second output signal from this block contains the quantization 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 your data as training data, to obtain appropriate partition and codebook parameters Set Quantization partition to [0, 1, 3]. Set Quantization 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 are not 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 warning messages MNP/CE00039-2/Signal Processing / Sem1 2008 7

Scope In the Simulink Sinks library o After double-clicking the block to open it, click the Parameters icon and set Number of axes to 2. Connect the blocks as shown in the figure. Also, from the model window's Simulation menu, choose Configuration 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 and title exactly match those in the figure, right-click each plot area in the scope and select Axes properties.)

Scalar Quantization Example 2


This example, shown in the figure below, illustrates the nature of scalar quantization more clearly. It samples 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 vertical coordinate of each flat part of the polygonal curve is a value in the Quantization codebook vector.

To open the completed model, click here in the MATLAB Help browser. To build the model, gather and configure these blocks: Sine Wave, in the Simulink Sources library (not the Sine Wave block in the Signal Processing Blockset DSP Sources library) MNP/CE00039-2/Signal Processing / Sem1 2008 8

Zero-Order Hold, in the Simulink Discrete library. The Zero-Order Hold block samples and holds its input for the specified sample period. The block accepts one input and generates one output, both of which can be scalar or vector. If the 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 means the Sample time is inherited. This block provides a mechanism for discretizing one or more signals in time, or resampling the signal at a different rate. If your model contains multirate transitions, you must add ZeroOrder Hold blocks between the fast-to-slow transitions. The sample rate of the Zero-Order Hold must be set to that of the slower block. For slow-to-fast transitions, use the Unit Delay block. For more information about multirate transitions, refer to the Simulink or the Real-Time Workshop documentation. o Set Sample time to 0.1. Quantizing Encoder o Set Quantization partition to [-1:.2:1]. o Set Quantization 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 the Parameters icon and set Number of axes to 2.

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

Determining Which Interval Each Input Is in


The Quantizing Encoder block also returns a signal, at the first output port, that tells which interval each 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 to 3; the 6th interval consists of real numbers greater than 8 but less than or equal to 9; and the 5th interval 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, gather and configure these blocks: Constant, in the Simulink Sources library o Set Constant value to [2, 9, 8]. Quantizing Encoder o Set Quantization partition to [3, 4, 5, 6, 7, 8, 9]. o Set Quantization codebook to any vector whose length exceeds the length of Quantization Partition by one. MNP/CE00039-2/Signal Processing / Sem1 2008 9

Terminator, in the Simulink Sinks library

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, choose Configuration 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 the Quantizing Decoder block, and connecting the output of the Quantizing Decoder block to another Display block. If the two source coding blocks' Quantization codebook parameters match, then the output of the Quantizing Decoder block will be the same as the second output of the Quantizing Encoder block. Thus the Quantizing Decoder block partially duplicates the functionality of the Quantizing Encoder block, but requires different input data and fewer.

Assignment Problem set 1:


Construct the following model

Quantizing Encoder (8 levels): o Set Quantization partition to [0.5,1.5,2.5,3.5,4.5,5.5,6.5]. o Set Quantization 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
MNP/CE00039-2/Signal Processing / Sem1 2008 10

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 8 quantization levels. Generate bar charts for all digitized bits within one figure window. ( plot MSB chart first). 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 signal and 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.

MNP/CE00039-2/Signal Processing / Sem1 2008 11

You might also like