[Math] diffusion equation plot (matlab or maple)

mapleMATLABordinary differential equations

The advection diffusion equation is the partial differential equation $$\frac{\partial C}{\partial t} = D\frac{\partial^2 C}{\partial x^2} – v \frac{\partial C}{\partial x}$$ with the boundary conditions $$\lim_{x \to \pm \infty} C(x,t)=0$$ and initial condition $$C(x,0)=f(x).$$

C(x,t)=Q/(2*square-root(D*pi*t))*exp((-(x-v*t)^2)/4*D*t), Q is the mass.

Here D is the diffusivity and v is the advection velocity.
How can plot with Matlab or Maple for Q = 1 and D = 1,
C(x, t) at t = 1 for v = 0, v = 0.1 and v = 1.0. Superimpose the three curves on the one axis.

Thanks for any help.

Best Answer

This seems to do the trick in maple...

Diffuse := (t, x) -> 1/(2sqrt(Pi t))exp(-(x-v t)^2/4 t);
plot([subs(v = 0, Diffuse(1, x)), subs(v = .1, Diffuse(1, x)), subs(v = 1, Diffuse(1, x))], x = -2 .. 2, colour = [red, blue, green])

enter image description here

Related Question