Simplified lnp.m and customized it for sigmoid function