least significant bit process
显示 更早的评论
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);
回答(1 个)
Walter Roberson
2013-3-17
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 个评论
Internazionale
2013-3-17
Walter Roberson
2013-3-17
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.
类别
在 帮助中心 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!