%Works in two modes: %When erfScale<0, returns flipped horizontally Heaviside Function. %Otherwise, flips horizontally and shrinks erf by erfScale times. function retv=erfh(x,erfScale) if(erfScale<0) %In Heviside Mode: if(x>=0) retv=0; else retv=1; end else retv=0.5*erf(-(x*erfScale))+0.5; end end Copyright (C) 2009 Konstantin Kirillov