function [A,B,methodName] = system_matrix(method,M,M_rn,K,K_diff,C,Mout,Cout,S_t,S_x,dt)


switch method
    case 1 % Lax-Wendroff + Galerkin
        A = M;
        B = dt*C'- 0.5*dt^2*K - Mout*dt + 0.5*Cout'*dt^2; 
        methodName = 'LW';
        warning('Diffusion and Reaction not implemented') 
    case 2 % Lax-Wendroff with lumped mass matrix + Galerkin
        A = diag(sum(M)); 
        B = dt*C' - 0.5*dt^2*K - Mout*dt + 0.5*Cout'*dt^2; 
        methodName = 'LW-FD';
        warning('Diffusion and Reaction not implemented')
    case 3 % Crank-Nicolson + Galerkin
        A = M - 1/2*dt*C'+ 1/2*dt*Mout + 1/2*dt*K_diff ...
               + 1/2*dt*M_rn + S_t+ dt/2* S_x ;
        B = dt*C'-dt*Mout - dt*M_rn -dt*K_diff - dt*S_x ;
        methodName = 'CN';
    case 4 %% TG3 %%%
        alpha = 1/9;
        B = cell(3,1) ;
        A = M ;
        B{1} = dt/3*(C'-Mout)+alpha*dt^2*(-K+Cout');
        B{2} = dt*(C'-Mout) ; 
        B{3} = 0.5*dt^2*(-K+Cout');
        methodName = 'TG3' ;
        warning('Diffusion and Reaction not implemented')
    otherwise
        error('not available method')
end