You are on page 1of 2

PROGRAM:

function[binary]=kpl(value,bits)
x=value;
binary=[];
if value>=0 then
remainder(1,row)=modulo(x,2);
x=floor(x/2);
end;
binary=remainder;
else
maxval=2^(bits-1);
x=maxval;
binary[1,1]=1;
for power=2:bits,
if x + 2^(bits-power)<= value then
binary[1,power]=1
x=x+2^(bits-power);
else
binary[1,power]=0;
end;
end;
end;
endfunction;
ANSWER:
nth
sampl
e

0
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.

QUANTIZED VALUE
(RO)

QUANTIZED VALUE (T)

0000000000
0000111010
0001110011
0010101000
0011010111
0011111110
0100011100
0100110000
0100111001
0100110111
0100101010
0100010011
0011110010
0011001000
0010010111
0001100001
0000100111

0000000000
0000111011
0001110011
0010101000
0011010110
0011111101
0100011011
0100101111
0100111001
0100110111
0100101010
0100010010
0011110001
0011000111
0010010111
0001100000
0000100111

17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32
33

1000010100
1001001110
1010000110
1010111000
1011100101
1100001001
1100100100
1100110100
1100111010
1100110100
1100100100
1100001001
1011100101
1010111000
1010000110
1001001110
1000010100

nth
sample
0
1
2
3

nth
sample
0
1
2
3
4
5
6

QUANTIZED
VALUE

actual
0
- 184.40322
298.37067
- 298.37067

QUANTIZED
VALUE actual

0
253.80925
298.37067
96.946508
- 184.40322
- 313.72549
-84.40322

1000010011
1001001110
1010000101
1010111000
1011100100
1100001000
1100100011
1100110100
1100111001
1100110100
1100100011
1100001000
1011100100
1010111000
1010000101
1001001110
1000010011

QUANTIZED
VALUE (RO)

0000000000
1010111000
0100101010
1100101010

QUANTIZED
VALUE (RO)

0000000000
0011111110
0100101010
0001100001
1010111000
1100111010
1001010100

QUANTIZED
VALUE (T)

0000000000
1010111000
0100101010
1100101010

QUANTIZED
VALUE (T)

00000000000
00011111101
00100101010
00001100000
10010111000
10100111001
10001010100

You might also like