« View all new features in
Mathematica
9
◄
previous
|
next
►
New in
Mathematica
9
›
Advanced Hybrid and Differential Algebraic Equations
Automatic Discontinuity Handling
Solve a differential equation with discontinuities.
In[1]:=
X
sol = NDSolve[{y'[t] == 15/4 - Floor[y[t]] + DiracDelta[t - 2], y[0] == .1}, y, {t, 0, 6}];
Plot the solution and its derivative.
In[2]:=
X
Plot[Evaluate[{y[t], y'[t]} /. sol], {t, 0, 6}, PlotLegends -> {"y(t)", "y'(t)"}]
Out[2]=