Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

NM(II)

LAB 3: PDEs - HEAT EQUATION


Provided m-files: //

1D HEAT EQUATION
a) In Matlab, compute numerically by the Finite Difference Method approximate solutions uh of the
following one-space dimensional heat equation with Dirichlet boundary conditions:

ut ( x, t )  u xx ( x, t ) for (x, t )  (a, b)  [0, T ] (a, b)  (0, 4), T  ...


u (a, t )  g a (t ) for t [0, T ] with g a (t )  3, gb (t )  11
u (b, t )  gb (t ) for t [0, T ]
 
u ( x, 0)  f ( x) for x  ( a, b) f ( x)  6sin  x   2x  3
4 
In particular, use a uniform mesh for the space domain made of N subintervals - such that the space mesh step
size is h = (b-a)/N – and a uniform mesh also for the time domain with step size k. Use the standard second-
order accurate, centered finite difference approximation for the discretization of the second-order derivative in
space.

Implement and test for different space-time discretization step sizes (h and k) the fully explicit (FE), the fully
implicit (FI) and the Crank-Nicolson (CN) schemes (if you prefer, you can implement the general two-levels or
theta scheme and obtain the other three schemes as particular cases). Create suitable plots of the obtained
numerical (approximate) solutions. What about consistency, stability, convergence of the methods…does the
experiments confirm theory? What about the stationary state solution (solution for t   )? Discuss the
results.

You might also like