# How do I plot a system with gain, first-order lag and time delay?

I want to plot the output response of a system with gain, first-order lag and time delay, where the transfer function is

tf = 2 Exp[-0.1 s]/(.1 + s)


To plot a time delay, we need to use an approximation, as Mathematica's TransferFunctionModel is restricted to rational transfer functions. We can use a Padé approximation

pa = PadeApproximant[tf, {s, 0, 5}]


and then determine the output response and plot it using

model = TransferFunctionModel[pa, s]
output = OutputResponse[model, UnitStep[t], t];
Plot[output, {t, 0, 10}, PlotRange -> All]


My output response looks very weird:

Can somebody please explain to me what I'm doing wrong?

-
most likely the function is complex in that interval –  chris Oct 26 '12 at 9:45
b.t.w welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the FAQs! 3) When you see good Q&A, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. ALSO, remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign –  chris Oct 26 '12 at 14:24

If you add Chop to your output:

output = OutputResponse[model, UnitStep[t], t] // Chop
Plot[output, {t, 0, 10}, PlotRange -> All]


you will get

which is quite different. Chop removes small (in your case imaginary) roundoff errors. At this stage though I would try and make sure the result actually makes sense. These roundoff errors are slightly suspicious. One test you can do is ask for higher precision in the computation, via say

pa = PadeApproximant[tf, {s, 0, 5}]//N[#,20]&


which in this context seems to produce the same solution.

-
I was thinking the gap might have something to do with an imaginary component, but I tried using Re[], which didn't help that much. Thanks for introducing me to Chop! –  Gerrit Oct 26 '12 at 14:29
If I were you I would do a few tests to make sure the answer is correct though. The fact that you need to use Chop` is an indication that your result might not be very robust. –  chris Oct 26 '12 at 14:39