My guess is that the value of t
in Animate
is replaced into the Plot
too soon, when the variable t
is not yet present in the input. You can remedy this way:
With[{y = y},
Animate[Plot[y, {x, 0, 0.5}], {t, 0, 0.1},
AnimationRunning -> False]]
However, I would rather make the dependence on t,x
explicit from the start:
Clear[y, t, x];
y[t_, x_] = (8 y0/Pi^2) Sum[
Sin[n Pi/2] Sin[n Pi x/L] Cos[n Pi c t/L], {n, 1, 1}] /. {y0 ->
0.1, L -> 0.5, c -> 20};
Animate[Plot[y[t, x], {x, 0, 0.5}], {t, 0, 0.1},
AnimationRunning -> False]