function RO=defro_PN(fZ,fker,ee,W,T,range_rho,ToX)

%finding the regularization parameter for deconvolution

[N,m]=size(fZ);
if m>1;
   W=W'+W; 
   T=T*T';
end   
TK=(abs(fker).*T).^2;

 
 erho=@(rho)((1/N/m)*sum(sum(abs(fZ.*(rho*W)./(eps+rho*W+TK)).^2))-ee);  
  options=optimset('TolX',ToX);
  
 RO = fzero(erho,range_rho,options) ;
  %end
