The following solves a general one-dimensional second order differential
equation
-y''(x) + p(x)y'(x) + q(x)y(x) = r(x)
with specified Dirichlet boundary conditions
y(a) = aa, y (b) = bb
Change the functions p.m, q.m, r.m to whatever you like
The following solves the simple diffusion equation
-K d^2u/dx^2 + a u = du/dt
using either the implicit or explicit schemes. User input parameters
include K,a, the spatial interval x = [a,b], the time step dt, and the
total number of steps nt. You supply the initial condition u(t=0) as an
array of vales; this specifies the number of samples, n, and therefore the
sampling interval h = (b-a)/(n-1).
diff1d_implicit.m
run_diff1d_implicit.m
diff1d_explicit.m
run_diff1d_explicit.m
The following solves the simple diffusion equation
-K (d^2u/dx^2 + d^2u/dy^2) + a u = du/dt
using either the implicit or explicit schemes. User input parameters
include K,a, the sampling interval h, the time step dt, and the
total number of steps nt. You supply the initial condition u(t=0) as an
array of vales as an N by M array u0.