least significant bit process

7 views (last 30 days)
Internazionale
Internazionale on 17 Mar 2013
i have matrix A, let we say, A=rand(1,256). A contains important coefficient. Because A is decimal like 0.xxxx, so i make B=A*10000. i make this for i can process dec2bin because i don't know how to convert decimal number to biner. after i get B, C=dec2bin(B,18).
i got 256 binary value of C. i want process LSB every value of C, every bits in c(1,1) until C(1,256) @18 bits must change the least significant bit of F.
example, C(1,1) = 001101010101010111 embedded into least bits of F, from F(1,1) until F(1,18) and until the whole C
A=rand(1,256);
B=A*10000;
C=dec2bin(B,18);
D=rand(1,5000);
E=F*10000;
F=dec2bin(E,18);

Answers (1)

Walter Roberson
Walter Roberson on 17 Mar 2013
B = fix(A * 10000);
lsb = mod(B,2);
changed_B = B - lsb + newlsb;
where newlsb is the values (0 or 1) of the new bits.
  2 Comments
Internazionale
Internazionale on 17 Mar 2013
sir, i think you're wrong with my question. read my example.
Walter Roberson
Walter Roberson on 17 Mar 2013
B is not going to have 18 bits worth of integer information per location. The maximum value for any B entry is going to be 1 * 10000, and that will have about 13.28771238 bits of integer information.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!