How to update a matrix with the node number

1 view (last 30 days)
Boni_Pl
Boni_Pl on 5 May 2019
Edited: per isakson on 5 May 2019
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.

Answers (0)

Categories

Find more on Computational Geometry 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!