Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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

Let me rewrite this question, showing the original problem, as it is more subtle than the simple example I showed before using Sin[t]. Here we go again.

When I write this:

r= OutputResponse[TransferFunctionModel[Evaluate[1/(s^2+2*s+1)],s],UnitStep[t],t];
foo[s, t]

I get an empty plot. But when I write this

r= Chop@First@OutputResponse[TransferFunctionModel[1/(s^2+2*s+1),s],UnitStep[t],t];
foo[s, t]

I do not get an empty plot.

My question is: Why first example above does not produce a plot?

I know it has to do with how 's' and 't', the free parameters, to the calls to TransferFunctionModel[] and OutputResponse[]. But I do not see exactly why that is.


share|improve this question
It's good to see you are back, Nasser. – Leonid Shifrin Apr 17 '12 at 9:05
up vote 6 down vote accepted

In your first example, the Plot is inside a Module that localizes t into something like t$23. So, when you run foo[s, t], you are actually running something similar to

 r=E^-t$23 UnitStep[t$23];

The second line returns an expression of t. When you insert it in the last Plot, it doesn't run properly, because, the {t$23, ...} argument in Plot is held, it doesn't evaluate to t before plotting.

In the second example, however, you don't have this problem. r becomes an expression of whatever variable p you call in foo[s, p] (t in this case), and that's the same variable you are using in your Plot. Even if Plot holds its arguments, so it's "immune to evaluation", it's not immune to the lexical replacement Module does.

First example analogy:

Module[{x = x2},
 {x, Hold[x]}]

{x2, Hold[x$14454]}

Second example analogy:

 {x, Hold[x]}]

{x, Hold[x]}
share|improve this answer
@NasserM.Abbasi, edited. See if it's clearer now – Rojo Apr 17 '12 at 10:13

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.