edit the code of the function below, \"DrawResult\", which is for 2D frame analy
ID: 3713406 • Letter: E
Question
edit the code of the function below, "DrawResult", which is for 2D frame analysis, to work for a 3d frame with coordinateds X, Y, Z.
function DrawResult(NODES,MEMBERS,MATERIALS,SECTIONS,RELEASES,Qe,d,Scale,NSegs,Color,Width)
NMBs = size(MEMBERS,1);
NON = size(NODES,1);
dXY = reshape(d,3,NON)';
for i=1:NMBs
NID = MEMBERS(i,1:2);
MID = MEMBERS(i,3);
SID = MEMBERS(i,4);
RID = MEMBERS(i,5:6);
RLS = RELEASES(RID,:);
RL2 = reshape(RLS',1,6);
XY = NODES(NID,:);
E = MATERIALS(MID,1);%Elasticity
A = SECTIONS(SID,1);%Section area %%%-------New!!!------------
I = SECTIONS(SID,2);%Moment of inertial
Ke = MemberK(XY,E,A,I,[1,1,1;1,1,1]);%Member stiffness matrix. New!!!: A is an input
Q = Qe(i,:)';
de = reshape(dXY(NID,:)',6,1);
T = T2DFrame(XY);%New!!!
u = T*de;
uc = find(RL2==1);%Uncondensed degrees of freedoms
Q(uc,1) = u(uc,1);
Ke(uc,:)=0;
for j=1:size(uc,2)
Ke(uc(j),uc(j))=1;
end;
u = KeQ
DrawMember(XY,Scale*u,NSegs,Color,Width);
end;
Explanation / Answer
DrawResult(NODES,MEMBERS,MATERIALS,SECTIONS,RELEASES,Qe,d,Scale,NSegs,Color,Width)
NMBs = size(MEMBERS,1);
NON = size(NODES,1);
dXY = reshape(d,3,NON)';
for i=1:NMBs
NID = MEMBERS(i,1:3);
MID = MEMBERS(i,3);
SID = MEMBERS(i,4);
RID = MEMBERS(i,5:6);
RLS = RELEASES(RID,:);
RL2 = reshape(RLS',1,6);
XY = NODES(NID,:);
E = MATERIALS(MID,1);%Elasticity
A = SECTIONS(SID,1);%Section area %%%-------New!!!------------
I = SECTIONS(SID,3);%Moment of inertial
Ke = MemberK(XY,E,A,I,[1,1,1;1,1,1]);%Member stiffness matrix. New!!!: A is an input
Q = Qe(i,:)';
de = reshape(dXY(NID,:)',6,1);
T = T3DFrame(XY);%New!!!
u = T*de;
uc = find(RL3==1);%Uncondensed degrees of freedoms
Q(uc,1) = u(uc,1);
Ke(uc,:)=0;
for j=1:size(uc,3)
Ke(uc(j),uc(j))=1;
end;
u = KeQ
DrawMember(XY,Scale*u,NSegs,Color,Width);
end;DrawResult(NODES,MEMBERS,MATERIALS,SECTIONS,RELEASES,Qe,d,Scale,NSegs,Color,Width)
NMBs = size(MEMBERS,1);
NON = size(NODES,1);
dXY = reshape(d,3,NON)';
for i=1:NMBs
NID = MEMBERS(i,1:3);
MID = MEMBERS(i,3);
SID = MEMBERS(i,4);
RID = MEMBERS(i,5:6);
RLS = RELEASES(RID,:);
RL2 = reshape(RLS',1,6);
XY = NODES(NID,:);
E = MATERIALS(MID,1);%Elasticity
A = SECTIONS(SID,1);%Section area %%%-------New!!!------------
I = SECTIONS(SID,3);%Moment of inertial
Ke = MemberK(XY,E,A,I,[1,1,1;1,1,1]);%Member stiffness matrix. New!!!: A is an input
Q = Qe(i,:)';
de = reshape(dXY(NID,:)',6,1);
T = T3DFrame(XY);%New!!!
u = T*de;
uc = find(RL3==1);%Uncondensed degrees of freedoms
Q(uc,1) = u(uc,1);
Ke(uc,:)=0;
for j=1:size(uc,3)
Ke(uc(j),uc(j))=1;
end;
u = KeQ
DrawMember(XY,Scale*u,NSegs,Color,Width);
end;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.