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!