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.


  • 1
    $\begingroup$ It's good to see you are back, Nasser. $\endgroup$ Apr 17, 2012 at 9:05

1 Answer 1


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]}
  • $\begingroup$ @NasserM.Abbasi, edited. See if it's clearer now $\endgroup$
    – Rojo
    Apr 17, 2012 at 10:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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