Problem using Evaluate[] inside a Plot command. 5.1
- To: mathgroup at smc.vnet.net
- Subject: [mg54019] Problem using Evaluate[] inside a Plot command. 5.1
- From: Nasser Abbasi <nma at 12000.org>
- Date: Mon, 7 Feb 2005 03:13:26 -0500 (EST)
- Reply-to: nma at 12000.org
- Sender: owner-wri-mathgroup at wolfram.com
hello,
This is a really strange problem.
Mathematica 5.1, ControlSystems application 2.02 (latest)
Below are 2 simple examples, one works and the
other does not.
Any one can see why?
When I call a function inside Evaluate inside the
plot command it fails. But when I call the function
outside the plot command, then use Evaluate on
the result inside the plot, it works.
Shouldn't these things be the same?
Remove["Global`*"];
<< ControlSystems`
sys = TransferFunction[s, 1 / (s^2 + s + 1)];
(* ---- example that works -----*)
y = OutputResponse[sys, UnitStep[t], t] ;
Plot[{t^2 , Evaluate[y]},
{t, 0, 3},PlotRange -> All]
(*--- example that does not work ----*)
Plot[{t^2, Evaluate[OutputResponse[sys,UnitStep[t], t]]},
{t, 0, 3}, PlotRange -> All]
(*------ end ------------------------*)
I get the common error messages:
plot::plnr: .... is not a machine-size real
number at t=....
Notice that this does not happen for a function that
I make, see this below. it works.
g[t_] := t^3;
Plot[{ t^2, Evaluate[g[t]]}, {t, 0, 30}]
thanks,
Nasser