function D=spatial_samples(PSF,H,W)
[m,n]=size(PSF);
 num=m*n;
 M=H/m;
 N=W/n;
 NUM=M*N;
 I=kron([1:NUM]',ones(num,1));
 Temp1=kron(H*[0:n-1],ones(1,m));  
 Temp2=repmat(1:m,[1,n]);
 Temp3=Temp1+Temp2;
 [X,Y]=meshgrid(0:M-1,0:N-1);
 
 Temp4=(X*m+Y*H*n)';
 Temp4=Temp4(:);
Temp5=repmat(Temp3,[1,NUM]);
Temp6=kron(Temp4',ones(1,num));
J=Temp5+Temp6;
 S=repmat(reshape(PSF,[num,1]),[NUM,1]);

 D=sparse(I,J,S);

end