I am very confused with how the Plot command evaluates arguments for vector valued numerical functions. For example, when I run the following commands
Clear[f]
f = Interpolation[{{0, {0, 0}}, {1, {1, 2}}}]
Plot[f[t][[2]], {t, 0, 1}]
I get the error: Part::partw: Part 2 of InterpolatingFunction[{{0,1}},{5,3,0,{2},{2},0,0,0,0,Automatic,{},{},False},{{0,1}},{{{0,0}},{{1,2}}},{Automatic}][t] does not exist.
.
It seems like the Plot command is trying to evaluate U[t][[2]]
at some point instead of only calling U
for specific numeric values. How can I force Plot to only plug evaluate U
with actual numbers.
Thanks!
Plot[Evaluate[f[t]][[2]], {t, 0, 1}]
? $\endgroup$ – kglr Sep 7 '16 at 0:35