06.06.2022 Views

B. P. Lathi, Zhi Ding - Modern Digital and Analog Communication Systems-Oxford University Press (2009)

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

792 INTRODUCTION TO INFORMATION THEORY

minx=min (x) ;

maxx=max (x) ;

deltax= (maxx-minx) /(length (x) -1) ;

lowerx=minx-deltax/2;

upperx=maxx+deltax/ 2;

ncellx=ceil(length(x) ~(l/3) );

miny=min (y) ;

maxy=max (y) ;

deltay= (maxy-miny) /(length (y) -1) ;

lowery=miny-deltay/ 2;

uppery=maxy+deltay/2 ;

ncelly=ncellx ;

rout (l:ncellx, l:ncelly) =O ;

xx=round ( (x-lowerx) /(upperx-lowerx} *ncellx + 1/2 ) ;

yy=round ( (y-lowery) /(uppery-lowery) *ncelly + 1/2 ) ;

for n=l : length (x)

indexx=xx (n) ;

indexy=yy (n) ;

if indexx >= 1 & indexx <= ncellx & indexy >= 1 & indexy <= ncelly

rout ( indexx ,indexy) =rout ( indexx ,indexy) +l;

end ;

end ;

h=rout ;

estimate=O;

sigma=O;

count=O ;

% determine row and column sums

hy=sum(h) ;

hx=sum(h');

for nx=l :ncellx

for ny=l :ncelly

if h(nx ,ny) -=0

logf=log (h(nx,ny) /hx (nx) /hy (ny) );

else

logf=O ;

end ;

count=count+h (nx,ny ) ;

estimate=estimate+h (nx,ny ) *logf;

sigma=sigma+h (nx,ny ) *logf~2;

end;

end;

% biased estimate

estimate=estimate/count ;

sigma =sqrt ( (sigma/count-estimate~2) /(count-1) ) ;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!