I have an InterpolatingFunction that I'd like to plot, and I wonder why I have to perform a ReplaceAll on the following function:

Plot[Evaluate[IIz[r, t] /. soln] /. t -> 5, {r, 0, 490}, PlotRange -> {{0, 
 490}, {.000015, -.00035}}, AxesLabel -> Automatic]`

soln is the solution to a differential diffusion equation given by Mathematica (v. 9.0.1) as


When I plot the 3D solution, there is no problem in using

Plot3D[Evaluate[IIz[r, t] /. soln], {r, 0, 490}, {t, 0, 10}, 
 PlotRange -> 
 {{0, 490}, {0, 10}, {.000015, -.00035}}, 
 AxesLabel -> Automatic] 

and I would think that all I'd need to do to plot this in terms of a fixed t would be to replace t with a constant like so:

Plot[Evaluate[IIz[r, 5] /. soln] , {r, 0, 490}, 
 PlotRange -> {{0, 490}, 
 {.000015, -.00035}}, AxesLabel -> Automatic]`

However, when I input that, I get a blank plot… What gives?

For the original differential equation, see this question.


It will work as you expect if you get the solution in a form like

IIz ->InterpolatingFunction[...

and not like

IIz[r,t] -> ...

since in the second case you have to have the explicit t, not 5, in order for the match to succeed.

  • $\begingroup$ I didn't even realize that specification was unnecessary… Thank you for the clarification, and as you, say, it works perfectly. Is there any advantage to getting the solution in the original form rather than IIz[r,t]? $\endgroup$ – Dustin Wheeler May 24 '13 at 21:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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