%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% calculate normalize factor, fit for SRBR and RBR mode
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function Nn=cal_Nn(W,Pm,den0,kn,ssp,h,P)
k0=W/mean(ssp);  kz=W./ssp;                      
%%calculate Ln
k1=(sqrt(kz.^2-kn*kn)); k1=kn./k1; Ln=real(sum(k1)*2*h);
%%calculate Sn
Sn=Pm*Pm'*h;
%%calculate delta
delta=P*kn/k0/sqrt(k0*k0-kn*kn);                    
Nn=real(1/(Sn*den0*(1+delta/Ln)));    %%%normalize coefficient              
