| Author |
Comment/Response |
Autobot
|
02/26/12 08:46am
Hi there. Just wanted to make a 3d plot of the 1-d heat equation. Very new to Mathematica so a little green. This was all given
(ut is partial wrt time, etc...)
ut - 0.1uxx = f(x,t)
0<t<=2
2<=x<=3
u(0,t) = v (initial conditions)
u(x,2) = g1 (boundary conditions)
u(x,3) = g2
We are given u(x,t) = [sin(4x) + cos(2x)] [cos(t) + sin(t)]
And now Mathematica input
u[x, t] = (sin[4*x] + cos[2*x])*(cos[t] + sin[t])
dt = D[u[x, t], t]
dxx = D[u[x, t], {x, 2}]
v = (sin[4*x] + cos[2*x])*(cos[t] + sin[t])/.t->0
g1 = (sin[4*x] + cos[2*x])*(cos[t] + sin[t])/.x->2
g2 = (sin[4*x] + cos[2*x])*(cos[t] + sin[t])/.x->3
f = dt - 0.1*dxx
Then using NDSolve
pde = NDSolve[{D[u[x, t], {t, 1}] == 0.1*D[u[x, t], {x, 2}] + f,
u[x, 0] == v, u[2, t] == g1, u[3, t] == g2},
u, {x, 2, 3}, {t, 0, 2}]
NDSolve::ndnum: Encountered non-numerical value for a derivative at t == 0
Can't get away from this. Any help would be greatly appreciated.
URL: , |
|