Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
154 views

Lab 04 To Perform Source Coding in Simulink

The document describes how to perform source coding on a signal in Simulink. It explains that source coding is used to reduce redundancy or prepare data for processing. It provides instructions on opening relevant Simulink libraries and building a model to quantize a sample signal vector to specified values. It also provides two lab tasks as examples - to quantize different signal vectors and plot the original and quantized signals.

Uploaded by

Arshad Ali
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
154 views

Lab 04 To Perform Source Coding in Simulink

The document describes how to perform source coding on a signal in Simulink. It explains that source coding is used to reduce redundancy or prepare data for processing. It provides instructions on opening relevant Simulink libraries and building a model to quantize a sample signal vector to specified values. It also provides two lab tasks as examples - to quantize different signal vectors and plot the original and quantized signals.

Uploaded by

Arshad Ali
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Mobile Communication Lab

Lab 04

To Perform Source Coding on a Signal in


Simulink

Prepared by Engr Ali M Durrani


1
(CECOS University) ali@cecos.edu.pk
Source Coding
• Source coding, also known as quantization or
signal formatting.

• It is a way of processing data in order to reduce


redundancy or prepare it for later processing.

• Analog-to-digital conversion and data


compression are two categories of source coding.

Prepared by Engr Ali M Durrani


2
(CECOS University) ali@cecos.edu.pk
Source Coding Features of the Blockset
• Blocks in the Simulink Communication Toolbox Source
Coding library can:-

• Use a partition and codebook to quantize a signal.

• Implement differential pulse code modulation (DPCM).

• Compand a signal using a µ-law or A-law compressor or


expander.

• Encode or decode a signal using differential coding.


Prepared by Engr Ali M Durrani
3
(CECOS University) ali@cecos.edu.pk
Example 4a
• Quantize a signal to map a real vector
[-2.4 -1 -0.2 0 0.2 1 1.2 1.9 2 2.9 3 3.5] to a
new vector whose entries are either
-1, 0.5, 2, or 3

Terminator

Idx
[-2.4 -1 -0.2 0 0.2 1 1.2 1.9 2 2.9 3 3.5] U Quantizing
Encoder Q(U)
Signal From Quantizing
Workspace Scope
Encoder

Prepared by Engr Ali M Durrani


4
(CECOS University) ali@cecos.edu.pk
Building the Model
• To start building the model, follow these steps:

• Type commlib at the MATLAB prompt.


This opens the Communications Blockset main library.

• Type dsplib at the MATLAB prompt.


This opens the DSP Blockset main library.

• Type simulink3 at the MATLAB prompt.


This opens the Main Simulink Library.

• From the library's File menu, select New and then select Model.
Prepared by Engr Ali M Durrani
5
(CECOS University) ali@cecos.edu.pk
• Signal From Workspace

Set Signal to
[-2.4, -1, -0.2, 0, 0.2, 1, 1.2, 1.9, 2, 2.9, 3, 3.5]

Prepared by Engr Ali M Durrani


6
(CECOS University) ali@cecos.edu.pk
• Quantizing Encoder
- Set Quantization partition to [0, 1, 3].
- Set Quantization codebook to [-1, 0.5, 2, 3].
- Set Input signal vector length to 1.

Prepared by Engr Ali M Durrani


7
(CECOS University) ali@cecos.edu.pk
• Terminator
• Scope

Prepared by Engr Ali M Durrani


8
(CECOS University) ali@cecos.edu.pk
Running the Simulation
• Connect the blocks as shown in the figure.
• Set Stop time to 12

Terminator

Idx
4 -1 -0.2 0 0.2 1 1.2 1.9 2 2.9 3 3.5] U Quantizing
Encoder Q(U)
Signal From Quantizing
Workspace Scope
Encoder

Prepared by Engr Ali M Durrani


9
(CECOS University) ali@cecos.edu.pk
Lab Task 4a
• Quantize a signal to map a real vector
[-2.4 -1 -0.2 0 0.2 1 1.2 1.9 3 3.5] to a new
vector whose entries are either
0.5, 1 , 2 or 4
• Determine the stop time of the simulation
• Show the input and output signal in a single
scope

Prepared by Engr Ali M Durrani


10
(CECOS University) ali@cecos.edu.pk
Lab Task 4b
• Quantize a sampled sine wave and plots the
original and quantized signals
• Set Quantization partition to [-1:0.2:1].
• Set Quantization codebook to [-1.2:0.2:1].
• Set Input signal vector length to 1
• Set Stop time to 2*pi

Prepared by Engr Ali M Durrani


11
(CECOS University) ali@cecos.edu.pk

You might also like