Tygra_1983
Student
- Oct 8, 2021
- 125
Hi there guys,
I am working on a problem that is a 3 storey rigid frame structure using the Stiffness Method. I have checked and checked it and there seems to be nothing wrong with it. However, I am getting incorrect values for the moments at the nodes. I am comparing my code with SAP2000, and SAP2000 is producing different results.
Here is the structure with its loading and the lablled nodes.
Here is my Ocatve/MATLAB code:
[tt]clear, clc, close all
E = 2.1E+08;
I = 8.622E-04;
L = 5;
n = 12;
K = [4*E*I/L 2*E*I/L;
2*E*I/L 4*E*I/L]
T1 = zeros(2,n)
T2 = zeros(2,n)
T1(1,1) =1;
T1(2,2) = 1;
T2(1,2) = 1;
T2(2,6) = 1;
Km1 = T1'*K*T1;
Km2 = T2'*K*T2;
for i = 1:13
Tn
,:,i) = circshift(T1,[0,i])
if i >= 3
Tn
,:,i) = circshift(T1,[0,i+1])
if i >=6
Tn
,:,i) = circshift(T1,[0,i+2])
if i >= 9
Tn
,:,i) = circshift(T2,[0,i-8])
if i >=11
Tn
,:,i) = circshift(T2,[0,i-7])
endif
endif
endif
endif
end
for i = 1:13
Km
,:,i) = Tn
,:,i)'*K*Tn
,:,i);
end
Z = Km
,:,1)
for i = 1:12
Z = Z + Km
,:,i+1);
end
Ks = Km1 + Km2 + Z
Ks([1,5,9],
= []
Ks
,[1,5,9]) = []
F = [-41.6; 41.6; 0; 0; 0; 0; 0; 0;0]
theta = inv(Ks)*F
[/tt]
I am hoping there is somebody here that knows a bit about Octave/MATLAB and has experience with the Stiffness Method. Then you can copy and paste my code into Octave/MATLAB and check through it. As you can see I am working also on my programming skills. so, I hope this question is not too tendious and time consuming for you guys.
Many Thanks
I am working on a problem that is a 3 storey rigid frame structure using the Stiffness Method. I have checked and checked it and there seems to be nothing wrong with it. However, I am getting incorrect values for the moments at the nodes. I am comparing my code with SAP2000, and SAP2000 is producing different results.
Here is the structure with its loading and the lablled nodes.

Here is my Ocatve/MATLAB code:
[tt]clear, clc, close all
E = 2.1E+08;
I = 8.622E-04;
L = 5;
n = 12;
K = [4*E*I/L 2*E*I/L;
2*E*I/L 4*E*I/L]
T1 = zeros(2,n)
T2 = zeros(2,n)
T1(1,1) =1;
T1(2,2) = 1;
T2(1,2) = 1;
T2(2,6) = 1;
Km1 = T1'*K*T1;
Km2 = T2'*K*T2;
for i = 1:13
Tn
if i >= 3
Tn
if i >=6
Tn
if i >= 9
Tn
if i >=11
Tn
endif
endif
endif
endif
end
for i = 1:13
Km
end
Z = Km
for i = 1:12
Z = Z + Km
end
Ks = Km1 + Km2 + Z
Ks([1,5,9],
Ks
F = [-41.6; 41.6; 0; 0; 0; 0; 0; 0;0]
theta = inv(Ks)*F
[/tt]
I am hoping there is somebody here that knows a bit about Octave/MATLAB and has experience with the Stiffness Method. Then you can copy and paste my code into Octave/MATLAB and check through it. As you can see I am working also on my programming skills. so, I hope this question is not too tendious and time consuming for you guys.
Many Thanks