Trying to Calculate Node Displacement for a Truss using matrix

2 Ansichten (letzte 30 Tage)
Joseph
Joseph am 7 Jul. 2015
I am trying to calculate the node displacement of a Truss but my code is returning error. 'Unexpected matlab Function' in me for loop. Can Someone help me understand why my code is not working? Thank You
% Nodal Displacement
area = 7550 % mm^2
E = 69 % GPa
w = 4 % m
h = 3 % m
K = [1 0 -1 0; 0 0 0 0 ; -1 0 1 0; 0 0 0 0];
J_C = [0 0 ; w 0; w h; 2*w 0;2*w 2*h; 3*w 0; 3*w 3*h; 4*w 0;4*w 2*h; 5*w 0; 5*w h; 6*w 0];
BarC = [1 2; 2 3; 1 3;2 4;3 4; 4 5; 4 6; 5 6; 5 7; 6 7; 6 8; 6 9; 7 9;8 9; 8 10; 8 11; 9 11;10 11; 10 12; 11 12];
for iEL = 1:nEL
idBeg = BarC(iEL, 1);
idEnd = BarC(iEL, 2);
dx = J_C(idEnd,1) - J_C(idBeg, 1);
dy = J_C(idEnd,2) - J_C(idBeg, 2);
L = sqrt(dx*dx + dy*dy);
c = dx/L
s = dy/L
K(2*idBeg - 1,2*idBeg - 1) = c^2;
K(2*idBeg, 2*idBeg) = s^2;
K(2*idEnd - 1,2*idEnd - 1) = c^2;
K(2*idEnd, 2*idEnd) = s^2;
K(2*idEnd - 1,2*idBeg - 1) = c^2;

Antworten (0)

Kategorien

Mehr zu Structural Analysis finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by