Sigmoid function for any z(single element, vector or matrix)