You are on page 1of 1

Conversion Of Analogue To Digital Signal By Using Matlab

LAB#2
TASK#1:
n=8;
m=50;
x2=cos(2*pi*(0:(m-1))/m)
x2(find(x2>=1))=(1-eps)
xq=floor((x2+1)*(2)^(n-1))
xq=xq/2^(n-1)
xq=xq-(2)^(n-1)/2^n
xe=x2-xq
stem(x2,'b')
hold on
stem(xq,'r')
stem(xe,'g')
legend('exact','quantized','error','locator')
hold off

You might also like