Question: solving ode with Heaviside, symbolic

Hello,
Anyone has an idea what is wrong with the following code procedure?
the result of u(x) should be a continuous function of x (and it is continuous when solved numerically)

THANKS IN ADVANCE,
Gil Soffer
 

restart;
Heaviside(0):=1:Heaviside(0.):=1:
dats:={s(x)=-Dt*(x+h/2)+st};
eqs:={diff(u(x),x)=Heaviside(sY-s(x))*s(x)/E+Heaviside(s(x)-sY)*(sY/E+(s(x)-sY)/Esec),
      u(-h/2)=y0};
sol0:=simplify(dsolve(subs(dats,eqs),u(x)));
sol1:=int(lhs(eqs[1]),x)=eval(student:-simpson(subs(x=_x,subs(dats,rhs(eqs[1]))),_x=-h/2..x,40))+y0:

dat1:={Dt=-0.1,Esec=1,E=3,sY=0.8,st=0.05,y0=5,h=10};
plot([subs(evalf(subs(dat1,sol0)),u(x)),subs(evalf(subs(dat1,sol1)),u(x))],x=-5..5,title=u(x),legend=[symbolic,numeric]);
plot(subs(subs(dat1,subs(dats,eqs[1])),diff(u(x),x)),x=-5..5,title=diff(u(x),x));


Please Wait...