% Num. Math. - FS 2014 - Serie 6 Aufgabe 2 - heat equation

function s6_2()
  N=3000;
  N_t=200;

  % x values:
  h = 1/N;
  x = %%% only interior points

  % evaluate the Source term:
  RHS = %%%

  % Define the initial condition:
  u_0 = %%%

  % construct the matrix (sparse format):
  %%%
  A = %%% use gallery

  % Define time Step to reach final time T_end:
  T_end = 2; 
  Dt = T_end/N_t;

  % Do a sparse LR-decomposition of the Matrix %%%:
  [L,U] = %%%

  % Do the implicit Euler updates:
  u = u_0;
  for k=1:N_t
    u_new = %%%
    u_new = %%%
    u = u_new;
  end

  % Plotting the full solution:
  x_tot = (0:h:1)';
  u_tot = [0;u;0];
  plot(x_tot, u_tot)
  title(['Solution with N = ' num2str(N), ', N_t = ' num2str(N_t)]);
  xlabel('x')
  ylabel('u')
  
  % Save plot
  print('-depsc','pl6_2.eps')     
 
end

 
