MATLAB: How to use ode23s to solve heat equation

heat equation

assume ut=D*uxx D is constant, x = [-5:0.1:5], with delta_x=0.1 initial condition u(x0,0) = derivative of x boundary condition if x=-5 or 5 u(x,t)=0
hence can i write ODE that satisfy u1 to u99? then use ODE23s solve heat equation with initial data u50=1 and uj=0 where j=/50?
thank you!!

Best Answer

If you are still interested in a solution for your problem:
Choose
u(x)=1/eps*max(1-abs(x/eps),0)
for eps=0.001, e.g. as initial condition for your Problem (this is an approximation to the Dirac Delta function).
Choose a very fine grid around x=0 such that the initial guess function is sufficiently resolved.
Then write the usual ODEs that result from
ut=D*uxx
and solve them using ODE15s.
If needed, I could also give you the analytical solution for comparison.
Best wishes
Torsten.
Related Question