function T=d2hist( XY, x_plt,y_plt )
T=zeros(length(y_plt), length(x_plt));
V_4T=XY;


lb.x=x_plt(1); ub.x=x_plt(length(x_plt));
lb.y=y_plt(1); ub.y=y_plt(length(y_plt));

db.x=x_plt(2)-x_plt(1);
db.y=y_plt(2)-y_plt(1);
%constructing transition matrix..................
for n=1:length(V_4T)
    i=floor( (V_4T(n,1)-lb.x)/db.x + 1 ) ;     
  
    j=floor( (V_4T(n,2)-lb.y)/db.y + 1 );
    if (i>=1 & i <=length(x_plt) &...
        j>=1 & j <=length(y_plt))     
        T(j,i)=T(j,i)+1;       
    end
end

%...................................................
