How to update a matrix with the node number
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello
I have a circular geometry which is discretised by triangular elements. Now suppose the total number of triangle is 4 with 3 nodes like T=[1 2 3;6 5 8;8 11 4;10 3 12] and boundary nodes are B=[1 3 5 10 12]. Now boundary condition for each boundary node of a triangle Q=7.5 and size of Q is 3x3.
Q=zeros(3,3);
for i=1:size(T,1)
n=T(i,:) %nodes of each triangle
z=intersect(n,B); %boundary node present in each triangle
if(z==n(1,1))
Q(1,1)=7.5;
if(z==n(1,2))
Q(2,1)=7.5;
if(z==n(1,3))
Q(3,1)=7.5;
end
end
end
end
This code is not working. I didn't get the matrix like for 1st triangle Q=[7.5 0 0;0 0 0;7.5 0 0], for 2nd triangle Q=[0 0 0;7.5 0 0;0 0 0], for 3rd triangle Q=[0 0 0;0 0 0;0 0 0], for 4th triangle Q=[7.5 0 0;7.5 0 0;7.5 0 0]
Please help me.
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Contour Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!