function y = heaviside(x,h) if x < -h y = 0; elseif x>h y=1; else y = 0.5*(1+x/h+sin(pi*x/h)/pi ); end