How to developed MATLAB code of the Discrete time signal

3 views (last 30 days)
Create a discrete time signal X of your choice
consisting of M samples, with M>10. Then,quantize the amplitude of the signal X to
L=2N quantization levels, with N>1 (X is the
quantized signal). Critically compare graphically
Xg with X. After that, encode the quantized
signal Xg using Huffman coding (Xp is the
encoded signal)

Answers (1)

charan
charan on 11 Feb 2025
Hi,
A discrete time signal can be quanitized into "L" levels similar to the code shown below:
L=4;
X=rand(1,10)
X = 1×10
0.0980 0.7890 0.2382 0.4658 0.4220 0.2183 0.7916 0.8059 0.5159 0.8716
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
Xg=round(X*(L-1))/(L-1)
Xg = 1×10
0 0.6667 0.3333 0.3333 0.3333 0.3333 0.6667 0.6667 0.6667 1.0000
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
You can also use the "quantizer" object to quantize data. You can refer to the following link for the same:
Once the data is quantized calculate the probability of occurence of each symbol (unique value) in "Xg". Once the probabilities are obtained use the "huffmandict" function to create the code word dictionary. Pass the signal and the created dictionary as input to "huffmanenc" function to obtain the Huffman encoded signal. You can refer to the following links:

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!