The same problem was modelled in ANSYS using 8 noded quadrilateral
elements and results were obtained using the same metal and properties. A part of the results obtained are plotted in the following figure. The plot shows the temperature of the nodes the upper boundary.
The following figure shows the contour plot of temperature at all the nodes obtained using ANSYS.
The data obtained using MATLAB code for the same nodes has been plotted below for the upper boundary and it is pretty much the same.
Thus, the code written and the modelling of the problem seems to be correct as the final result at steady state is almost same by both the methods.
Conclusion More accurate results could have been obtained by using a finer meshing and by taking 6 noded elements since the currently used 3 noded triangular elements can account for linear variation only in the field variable. The code written is sufficient enough to work with a more refined mesh and it will not require any changes in case a finer mesh is given to it for solving.