control systems - On using DiracDelta[t] in OutputResposne in version 10. Different result from version 9
I am baffled by this. I was trying to run same example I had working in version 9.01 and found now I get empty plots.
The example is here . Here is a simplified version of the above. The same exact example produces a plot in version 9.01. But in Version 10, it is empty.

w = 1; z = 0.07;
sys = TransferFunctionModel[w^2/(s^2 + 2 z*w*s + w^2), s];
fun = First@OutputResponse[sys, DiracDelta[t], {t, 0, 20}];
Plot[Evaluate[%], {t, 0, 20}]
I tried to find what is going on, so I asked for analytical solution, in version 10 it says:
w = 1; z = 0.07;
sys = TransferFunctionModel[w^2/(s^2 + 2 z*w*s + w^2), s];
fun = First@OutputResponse[sys, DiracDelta[t], t] // ComplexExpand // Simplify // Chop

In version 9.01:
w = 1; z = 0.07;
sys = TransferFunctionModel[w^2/(s^2 + 2 z*w*s + w^2), s];
fun = First@OutputResponse[sys, DiracDelta[t], t] // ComplexExpand // Simplify // Chop

So in version 10 the solution seems to be reversed. going back in time !
Plot[Evaluate[fun], {t, -20, 0}]

Any idea what is going on? What changes could have caused this?
Answer
In versions 8 and 9, OutputResponse (and StateResponse) was doing its own processing of DiracDelta, before passing stuff on to NDSolve, etc. This was creating issues as NDSolve and the others were being constantly improved and updated. Now we let the core functions handle the preprocessing, but then we have to deal with a little quirk (aka bug) like this. The behavior you are seeing is just propagating upward from those functions.
eqs[Δ_] := {y[t] + 0.14 y'[t] + y''[t] == DiracDelta[t - Δ], y[0] == 0, y'[0] == 0};
Δ = {0, 0.001};
y[t] /. DSolve[eqs[#], y[t], t] & /@ Δ;
Plot[%, {t, -20, 20}, PlotRange -> All, PlotLegends -> Δ]

y[t] /. NDSolve[eqs[#], y[t], {t, 0, 20}] & /@ Δ;
Plot[%, {t, 0, 20}, PlotLegends -> Δ]

Comments
Post a Comment