function ipi=ipf(cr,D,w)

ipi=(1-tanh((abs(cr)-D/2)*w))/2;