MATLAB: How to wirte algorithm for meshing line element

algorithmfinite element methodmeshtruss

Hi,
As you see in the figure, there is a truss structure composed of 2 elements and 3 nodes. In my code, ın order to calculate the stifness and mass matrices, X,Y and Z coordinate table(Table1) and elements table(Table 2) which is made manually are needed. The code runs with these initial information. Now, i want to divide these two elements into more elements whose number depends on the user.
My question is about the algoritm that will create Table1 and Table 2 automatically. What do you think about it? Is ıt possbible? If yes, would you write the steps for algorithm. I just need ideas.
truss2.JPG

Best Answer

ı solved it :)
Anyone who needs the same algorithm can send message to me.