Explore BrainMass

Quantization in Matlab

This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

This is what I have so far:
EDU>> %Sampling, Quantizing, Coding
EDU>> %Analog Signal
EDU>> t= [0:0.025:1];
EDU>> %Sampled Signal
EDU>> x= 0.8*cos(2*pi*t)+0.15;
EDU>> Ts=0.025; n=length(t);n=0:N-1;
EDU>> xs = 0.8*cos(2*pi*n*Ts);
EDU>> hold on
EDU>> plot (t,x);
EDU>> hold on
EDU>> %Quantized Signal
EDU>> Q=2;
b.) The four level quantizer, (see Figure 1.2), corresponding to the 2 bit ADC is defined as:
Ã?ºâË?â? ââ?°¤x(nTs)<(Ã?º+1)âË?â? ââ? 'x Ã?â??(nTs)= Ã?ºâË?â?  Ã?º= -2,-1,0,1
Where x(nTs), found above, is the input and x Ã?â??(nTs) is the output of the quantizer. Let the quantization step be âË?â?  = 0.5. Plot the input-output characterization of the quantizer, and find the quantized output for each of the sample values of the sampled signal x(nTs).

c.) To transform the quantized values into unique binary 2 bit values, consider the following code:
x Ã?â??(nTs) = -2âË?â?  ââ? '10
x Ã?â??(nTs) = -âË?â?  ââ? '11
x Ã?â??(nTs) = 0âË?â?  ââ? '00
x Ã?â??(nTs) = âË?â?  ââ? '01
Obtain the digital signal corresponding to x(t).

© BrainMass Inc. brainmass.com March 21, 2019, 11:09 pm ad1c9bdddf

Solution Preview

figure;stem(t,x);title('Sampled Signal')

q = quantizer('nearest',[4 ...

Solution Summary

This solution descrines the quantization of an analog signal using matlab.