% computes the bit-plane representations of a
% 4x4 4-bit image 
%
clear
x=[8,1,7,3;1,11,15,12;0,11,7,13;2,10,9,6];
% 4x4 4-bit input image x
%
x = double(x); % returns double-precision values for x
% floor(c) rounds c to the nearest integer less than
% or equal to c
% mod(a,2) returns a -(q)(2), where q= floor(a/2)
bp0 = mod(x,2) % least significant bit plane
bp1 = mod(floor(x/2),2)  
bp2 = mod(floor(x/4),2)
bp3 = mod(floor(x/8),2) % most significant bit plane
%
bp0+2*bp1+4*bp2+8*bp3 % recontructed image

