function [A,B] = System(M,K,C,Ka,Dif,dt,method,nu,sigma,W,w,tau)
tauW = tau*W;
tauW_T = tauW'*W;
tauW_w = tauW'*w;

    switch method
    
        case 1 % Crank-Nicholson + Galerkin
        A = M + 1/2*dt*(C + nu*K + sigma*M);
        B = -dt*(C + nu*K + sigma*M);
        
        case 2 %R22 + Galerkin
        A = [M + dt*W(1,1)*(C + nu*K + sigma*M), dt*W(1,2)*(C + nu*K + sigma*M);
             dt*W(2,1)*(C + nu*K + sigma*M), M + dt*W(2,2)*(C + nu*K + sigma*M)];
        
        B = [-dt*(C + nu*K + sigma*M)*w(1);
             -dt*(C + nu*K + sigma*M)*w(2)];
        
        case 3 %CN + SUPG
            
        A = M + W*dt*(C + nu*K + sigma*M) + tauW*C' + dt*tauW_T*Ka - dt*tauW_T*Dif*nu + dt*tauW_T*sigma*C';
        B = -dt*(C + nu*K + sigma*M) - tauW_w*dt*Ka + tauW_w*dt*Dif*nu - tauW_w*dt*sigma*C';
        
        case 4 %R22 + SUPG

        A = [M + dt*W(1,1)*(C + nu*K + sigma*M) + tauW(1,1)*C' + dt*tauW_T(1,1)*Ka - dt*tauW_T(1,1)*Dif*nu + dt*tauW_T(1,1)*sigma*C',...
            dt*W(1,2)*(C + nu*K + sigma*M) + tauW(1,2)*C' + dt*tauW_T(1,2)*Ka - dt*tauW_T(1,2)*Dif*nu + dt*tauW_T(1,2)*sigma*C';
             dt*W(2,1)*(C + nu*K + sigma*M) + tauW(2,1)*C' + dt*tauW_T(2,1)*Ka - dt*tauW_T(2,1)*Dif*nu + dt*tauW_T(2,1)*sigma*C',...
             M + dt*W(2,2)*(C + nu*K + sigma*M) + tauW(2,2)*C' + dt*tauW_T(2,2)*Ka - dt*tauW_T(2,2)*Dif*nu + dt*tauW_T(2,2)*sigma*C'];
        
        B = [-(dt*(C + nu*K + sigma*M)*w(1) + tauW_w(1)*dt*Ka - tauW_w(1)*dt*Dif*nu + tauW_w(1)*dt*sigma*C') ;
             -(dt*(C + nu*K + sigma*M)*w(2) + tauW_w(2)*dt*Ka - tauW_w(2)*dt*Dif*nu + tauW_w(2)*dt*sigma*C')];
    end
    

end