

% Time discretization
disp(' ')
tEnd = cinput('End time', 5);
nStep = cinput('Numnber of time-steps', 120);
dt = tEnd / nStep; 
% Courant = a*dt/h; 
% disp(['Courant number: ', num2str(Courant)]); 


% SYSTEM RESULTING OF DISCRETIZING THE WEAK FORM
[M,K,C] = FEM_matrices_unsteady(X,T,referenceElement,example,dt);

disp(C)
disp(K)




%%%%%%%%%%%%%%%%%%!!!!!!!!!Check everything from here on :), old code%%%


% Initial condition
u0 = InitialCondition(X); 

xx  = reshape(X(:,1), ny+1, nx+1)'; 
yy  = reshape(X(:,2), ny+1, nx+1)'; 
u0_dib = reshape(u0, ny+1, nx+1)';  
figure(2); clf; 
surface(xx,yy,u0_dib,'FaceColor','interp');
set(gca,'FontSize',12)
grid on
view(3)
figure(3); clf;
[C,h]=contour(xx,yy,u0_dib,[-0.1,-0.01,0.1:0.1:1.0]);
clabel(C,h,'FontSize',12);
axis equal; axis(dom);
set(gca,'FontSize',16,'XTick',-0.5:0.25:0.5,'YTick',-0.5:0.25:0.5)

[M,K,C] = FEM_matrices(X,T,Conv,referenceElement); 
[Mout,Cout] = Boundary_matrices(X,T,Conv,referenceElement,velo);


% Boundary conditions (Lagrange multipliers)
[ADir,bDir,nDir] = BoundaryConditions(X,velo);


% Finish the code to be able to solve the problem
% ...
% ...
% ...

