function U = burgers_imNR(X,T,At,nTimeSteps,u0,uxa,uxb,E)
m = length(X)-1;

% Allocate memory for the solution matrix
U = zeros(m+1,nTimeSteps+1);

% Initial condition
U(:,1) = u0;

% Boundary conditions
U(1,:) = uxa';
U(m+1,:) = uxb';

M = computeMassMatrix(X,T); 
K = computeDiffussionMatrix(X,T); 

%Accd = zeros(2,m+1); Accd(1,1) = 1; Accd(2,m+1) = 1;  
for n = 1:nTimeSteps
    bccd = [uxa; uxb]; 
    U0 = U(:,n); 
    U1 = U0;
    error_U = 1; k = 0; 
    while (error_U > 0.5e-5) && k < 100
        C= computeConvectionMatrix(X,T,U1);
        D= computeConvectionMatrix2(X,T,U1);
        Ui=U1;
        J = M + E*At*K + At*C + At*D;
        f = (M + At*C + E*At*K)*U1 - M*U0;
        U1 = U1 - J\f;
        error_U = norm(U1-Ui)/norm(U1); 
        k = k+1; 
    end
    U(:,n+1) = U1;  
end


