Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:

time delay plot

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

share|improve this question
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
up vote 3 down vote accepted

If you add Chop to your output:

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

you will get

Mathematica graphics

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.

share|improve this answer
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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.