It is not enough to know the coordinates of the nodes... you should specify the element stifness matrix in order to be able to assemble the global stiffness matrix.
The assembly algorithm for the FEM looks something like this:
for i=1:ldof
ii=gdof(i);
for j=1:ldof
jj=gdof(j);
M(ii,jj) = m(i,j) + M(ii,jj);
K(ii,jj) = kt(i,j) + K(ii,jj);
end
end
gdof is a vector that contains the global degrees of freedom of the element and ldof is a vector that contains the local degrees of freedom of the element.
Several points are to be clarified before the question can be answered fully. However, if the questioner is less conversant with FEM than FDM, following may provide some explanation. In FDM nodes are regularly spaced in square grid, the difference equation for a particular phenomena is written at a node and applied to all the nodes for final solution. Thus nodal coordinates are sufficient for solution. FEM is a more powerful technique and it is different from FDM in following respect.
1. First domain is to be divided in elements (simplest is triangle with 3 nodes at corners). Besides supplying nodal coordinated the nodes associated with elements are to be specified (nodal connectivity). This is mesh generation (programs are available for this).
2. The governing equation of the physical phenomena under study (i.e. stress analysis, heat conduction, fluid flow etc.) is to be satisfied in the element, which results in generation of elemental stiffness matrix. Such stiffness matrices from all elements are assembled to form overall stiffness matrix, which is then solved to obtain parameter of interest (such as temperature) at all nodes. Some very efficient techniques have been developed to solve such huge matrices.
3. The colour plots of results are obtained for better visual presentation.
4. The above 3 steps are called PREPROCESSOR, SOLUTION and POST PROCESSOR.
Although one can develop his own program to perform all these steps, such efforts are far more difficult here than in FDM. Generally commercial packages, such as ANSYS, Nastran, Abaqus etc. or open source free packages (like ELMER) are available and can be used for all three stages stated above, even for very complex problems.
The 5th edition of "Programming the Finite Element Method", Wiley, 2014 describes a range of assembly algorithms using different storage strategies in Chapter 3. The book provides Fortran source code along with the explanatory materials. The source code is quite compact and easy to read. It is fairly straightforward to manually rewrite the code in Matlab format. See http://tinyurl.com/o27v6s2 for a link to a description of the book. Perhaps your University library can source a copy for you?
I suggest you to consult some lecture notes like, for example, Dr Cuneyt Sert, in his course ME 582 about finite element method. It is achievable through the link http://users.metu.edu.tr/csert/me582/ME582%20Ch%2002.pdf
I have coverted the code given above into c++. However I am having an error if I define the total size of my Matrix as (Total number of nodes)x (number of degrees of freedom per node). I get an out of bound error. Here both my node ordering and element ordering begin from 0. I am also open to share my full code in c++.