How to wirte algorithm for meshing line element?

조회 수: 2 (최근 30일)
hamit Kenan
hamit Kenan 2019년 4월 18일
편집: hamit Kenan 2021년 3월 9일
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

채택된 답변

hamit Kenan
hamit Kenan 2019년 4월 20일
ı solved it :)
Anyone who needs the same algorithm can send message to me.
  댓글 수: 2
Angkur Shaikeea
Angkur Shaikeea 2021년 3월 9일
Can you share your method please? is it vectorised?
hamit Kenan
hamit Kenan 2021년 3월 9일
편집: hamit Kenan 2021년 3월 9일
lambda=10; % Ibput Element Number
%%
es=size(H); % H is the Table 2 (ın my code it includes 13 column)
for i=1:es(1)
XX=linspace(B(H(i,2),1),B(H(i,3),1),lambda+1);
YY=linspace(B(H(i,2),2),B(H(i,3),2),lambda+1);
ZZ=linspace(B(H(i,2),3),B(H(i,3),3),lambda+1);
for j=1:(lambda)
h=size(B); %B is the Table 1
if j==lambda
else
B(h(1)+1,1)=XX(j+1)';
B(h(1)+1,2)=YY(j+1)';
B(h(1)+1,3)=ZZ(j+1)';
end
en1=H(i,2);
en2=H(i,3);
hh=size(H);
H(hh(1)+1,1)=hh(1)+1;
H(hh(1)+1,4)=H(i,4);
H(hh(1)+1,5)=H(i,5);
H(hh(1)+1,6)=H(i,6);
H(hh(1)+1,7)=H(i,7);
H(hh(1)+1,8)=H(i,8);
H(hh(1)+1,9)=H(i,9);
H(hh(1)+1,10)=H(i,10);
H(hh(1)+1,11)=H(i,11);
H(hh(1)+1,12)=H(i,12);
H(hh(1)+1,13)=H(i,13);
if j==1
MH=max(H);
MHH=[MH(2) MH(3)];
H(hh(1)+1,2)=en1;
H(hh(1)+1,3)=max(MHH)+1;
elseif j==lambda
bb=size(B);
H(hh(1)+1,3)=en2;
H(hh(1)+1,2)=bb(1);
else
bb=size(B);
H(hh(1)+1,2)=bb(1)-1;
H(hh(1)+1,3)=bb(1);
end
end
end
H(1:es(1),:)=[]; % This line uptades the Table 2 by deleting the old data.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Structural Analysis에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by