% generate bit matrix based on groupname_Bsize.mat clear; load 'hassebrook_Bsize'; % get sizes load 'hassebrook_r'; [M,N]=size(r) figure(1) plot(r); % demodulate first sequence, threshold with 0 level, (pos=1,neg=0) if max(r)>abs(min(r)) range=max(r) else range=abs(min(r)) end scale=1/(range*1.1); r1=r.*scale; % scale in such a way as not to move the zero level b1=ceil(r1); n=1:N; figure(2) plot(n,r1,n,b1); % demodulate second sequence r2=abs(r); % flip negative values to positive values % threshold at about 1.5, use peak value to estimate this %r2=r2-(max(r2)*(1.5/2.0)); r2=r2-1.5; % assume accurate estimate of quantization levels if max(r2)>abs(min(r2)) range=max(r2) else range=abs(min(r2)) end scale=1/(range*1.1); r2=r2.*scale; % scale in such a way as not to move the zero level b2=ceil(r2); figure(3) plot(n,r2,n,b2); Bs=zeros(Nseq,N); Bs(1,1:N)=b1(1:N); Bs(2,1:N)=b2(1:N); figure(4) imagesc(Bs); colormap gray save 'hassebrook_Bs' Bs;