How to update a matrix with the node number
2 views (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Categories
Find more on Contour Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!