Search code examples
plotwolfram-mathematica

Plotting function of 2D space + time using Plot3D in Mathematica


Is there a simple way of plotting a function f(x,y,t) = Exp[t-x-y] by setting the time t? I've tried several variations of

Plot3D[Evaluate[f[t,x,y],t->0],{x,0,1},{y,0,1},PlotRange -> All]

But I can't get it to work. I want to be able to change t and see how the plot changes, but I'm also using the equation f for a differential equation so I'm taking partials and I need t to be symbolic for other parts of the notebook. Or is there a way to make a plot video that updates with time?


Solution

  • Expanding on the comments.

    Interactively manipulate the plot

    f[x_, y_, t_] := Sin[t x] Sin[t y]
    Manipulate[Plot3D[f[x, y, t], {x, -Pi, 2 Pi}, {y, -Pi, Pi}], {t, 0, 3, 1/8}]
    

    Generate a list of plots

    plots = Table[Plot3D[f[x, y, t], {x, -Pi, 2 Pi}, {y, -Pi, Pi}], {t, 0, 3, 1/8}];
    

    Export the plots to an animated GIF

    Export["plots.gif", plots]
    

    enter image description here