I am trying to solve the the following system of couples PDEs using NDSolve. However I am struggling to plot the solutions. I am trying to plot |u1[t,x]|^2 (i.e. the square of the absolute value) but whenever I try I get a blank 3D box as opposed to any actual results. How could I get the results to show in 3D? I have attached the code below.
I have tried the following line:
Plot3D[u1[t, x] /. sol, {t, 0, 5}, {x, -a, a}] but it generates an blank box.
eq = {
I*D[u1[t, x], {t, 1}] + D[u1[t, x], {x, 2}] + u6[t,x]+u2[t,x] == 0,
I*D[u2[t, x], {t, 1}] + D[u2[t, x], {x, 2}] + u1[t,x]+u3[t,x] == 0,
I*D[u3[t, x], {t, 1}] + D[u3[t, x], {x, 2}] + u2[t,x]+u4[t,x] == 0,
I*D[u4[t, x], {t, 1}] + D[u4[t, x], {x, 2}] + u3[t,x]+u5[t,x] == 0,
I*D[u5[t, x], {t, 1}] + D[u5[t, x], {x, 2}] + u4[t,x]+u6[t,x] == 0,
I*D[u6[t, x], {t, 1}] + D[u6[t, x], {x, 2}] + u5[t,x]+u1[t,x] == 0,
u1[0, x] == f1,
u2[0, x] == f2,
u3[0, x] == f3,
u4[0, x] == f4,
u5[0, x] == f5,
u6[0, x] == f6,
u1[t, -a] == u1[t, a],
u2[t, -a] == u2[t, a],
u3[t, -a] == u3[t, a],
u4[t, -a] == u4[t, a],
u5[t, -a] == u5[t, a],
u6[t, -a] == u6[t, a]
};
sol = NDSolve[eq,{u1[t,x],u2[t,x],u3[t,x],u4[t,x],u5[t,x],u6[t,x]}, {t, 0, 5}, {x, -a, a}, MaxStepSize -> 0.07];
a, f1, f2, f3, f4, f5, f6
? $\endgroup$Plot3D
has the attributeHoldAll
. UseEvaluate
, i.e.,Plot3D[Evaluate[u1[t, x] /. sol], {t, 0, 5}, {x, -a, a}]
$\endgroup$