Professional Documents
Culture Documents
100.0000
u1
u2 = 56.0297
u3
66.7028
for the values of the solution at x = 0, 1, 3 and time 1 using t = 1 (these are the values suggested
by the textbook) . If you use evenly spaced points xi = (i 1)/3, i = 1, 2, 3, 4 as in the example
file, then with t = 1 at time 1 you should find the values
100.0000
u1
u2 56.9557
u3
59.5761
u4
68.5547
Of course, with a properly modified example file you can use a finer grid and obtain a smoothly
varying solution. If you plot the time evolution, I suggest you make a plot only every 25 or 50 time
steps. To plot every 50 steps you can use
if(rem(k, 50) == 0)plot(xvec, uold); end,
where k is the time step counter, uold the solution, and xvec the vector of grid points at which
uold is defined.