F:\Yazd Uni-96-Winter\Nonlinear Analysis\Example 5,6\Example8.
m Page 1
1 clc
2 clear all
3
4 %Input Data
5 Lab=10; %lenght of AB (m)
6 Lbc=10; %lenght of BC (m)
7 Cxab=0; %lenght of AB rigid zone in x direction (m)
8 Cyab=1; %lenght of AB rigid zone in y direction (m)
9 Cxba=0; %lenght of BA rigid zone in x direction (m)
10 Cyba=1; %lenght of BA rigid zone in y direction (m)
11 Cxbc=1; %lenght of BC rigid zone in x direction (m)
12 Cybc=0; %lenght of BC rigid zone in y direction (m)
13 Cxcb=1; %lenght of CB rigid zone in x direction (m)
14 Cycb=0; %lenght of CB rigid zone in y direction (m)
15 Lndxab=0; %Cos. of Angle between AB and x direction
16 Lndyab=1; %Cos. of Angle between AB and y direction
17 Lndxbc=1; %Cos. of Angle between BC and x direction
18 Lndybc=0; %Cos. of Angle between BC and y direction
19 E=2e8; %Modulus of Elasticity (kN/m^2)
20 bab=0.4; %Column section width
21 hab=0.4; %Column section heigth
22 Aab=bab*hab;
23 Iab=(bab*hab^3)/12;
24 bbc=0.2; %Beam section width
25 hbc=0.4; %Beam section heigth
26 Abc=bbc*hbc;
27 Ibc=(bbc*hbc^3)/12;
28 wab=-10; %Max. Value of Triangular Loading on AB (kN)
29 Pbc=-100; %Concentrated Load at middle of BC (kN)
30 Pnfst=[50;0;0;0;0]; %Nodal force matrix on free DOF (kN)
31 syms x y;
32 as=[1 -y];
33 Alfa=12e-6; %Thermal Expansion Coeff.
34 DTa=-10; %Temperature Difference in lenght
35 DT=25; %Temperature Difference in Section Height
36
37 %Calculating Element Matrices
38 %AB Matrices: brab bjab bbab bgab d0ab ktab Kab Kabf
39 disp ('Element AB Matrices: ')
40 Lab=Lab-(Cxab^2+Cyab^2)^0.5-(Cxba^2+Cyba^2)^0.5
41 brab=eye(6); %Create 6 by 6 Identity Matrix
42 brab(1,1)=Lndxab;
43 brab(2,2)=Lndxab;
44 brab(4,4)=Lndxab;
45 brab(5,5)=Lndxab;
46 brab(1,2)=-1*Lndyab;
47 brab(4,5)=-1*Lndyab;
48 brab(2,1)=Lndyab;
49 brab(5,4)=Lndyab;
50 brab
51
52 bjab=eye(6); %Create 6 by 6 Identity Matrix
53 bjab(3,1)=-1*Cyab;
54 bjab(3,2)=Cxab;
55 bjab(6,4)=Cyba;
F:\Yazd Uni-96-Winter\Nonlinear Analysis\Example 5,6\Example8.m Page 2
56 bjab(6,5)=-1*Cxba;
57 bjab
58
59 bbab=zeros(6,3); %Create 6 by 3 Zero Matrix
60 bbab(1,1)=-1;
61 bbab(2,2)=1/Lab;
62 bbab(2,3)=1/Lab;
63 bbab(3,2)=1;
64 bbab(4,1)=1;
65 bbab(5,2)=-1/Lab;
66 bbab(5,3)=-1/Lab;
67 bbab(6,3)=1;
68 bbab
69
70 bgab=bjab*brab*bbab
71
72 Ktab=zeros(3); %Create 3 by 3 Zero Matrix
73 Ktab(1,1)=E*Aab/Lab;
74 Ktab(2,2)=4*E*Iab/Lab;
75 Ktab(2,3)=2*E*Iab/Lab;
76 Ktab(3,2)=2*E*Iab/Lab;
77 Ktab(3,3)=4*E*Iab/Lab;
78 Ktab
79
80 Kab=bgab*Ktab*bgab.'
81
82 Kabf=Kab;
83 Kabf(1,:)=[]; %Deleting Row 1
84 Kabf(1,:)=[]; %Deleting Row 2
85 Kabf(1,:)=[]; %Deleting Row 3
86 Kabf(:,1)=[]; %Deleting Column 1
87 Kabf(:,1)=[]; %Deleting Column 2
88 Kabf(:,1)=[]; %Deleting Column 3
89 Kabf(5,5)=0; %Expanding Kabf to a 5 by 5 matrix
90 Kabf
91
92 adab=[1/Lab 0 0;0 6*x/(Lab^2)-4/Lab 6*x/(Lab^2)-2/Lab]
93
94 %BC Matrices: brbc bjbc bbbc bgbc d0bc ktbc Kbc Kbcf
95 disp ('-----------------------------------------------------------------')
96 disp ('Element BC Matrices: ')
97 Lbc=Lbc-(Cxbc^2+Cybc^2)^0.5-(Cxcb^2+Cycb^2)^0.5
98 brbc=eye(6); %Create 6 by 6 Identity Matrix
99 brbc(1,1)=Lndxbc;
100 brbc(2,2)=Lndxbc;
101 brbc(4,4)=Lndxbc;
102 brbc(5,5)=Lndxbc;
103 brbc(1,2)=-1*Lndybc;
104 brbc(4,5)=-1*Lndybc;
105 brbc(2,1)=Lndybc;
106 brbc(5,4)=Lndybc;
107 brbc
108
109 bjbc=eye(6); %Create 6 by 6 Identity Matrix
110 bjbc(3,1)=-1*Cybc;
F:\Yazd Uni-96-Winter\Nonlinear Analysis\Example 5,6\Example8.m Page 3
111 bjbc(3,2)=Cxbc;
112 bjbc(6,4)=Cycb;
113 bjbc(6,5)=-1*Cxcb;
114 bjbc
115
116 bbbc=zeros(6,3); %Create 6 by 3 Zero Matrix
117 bbbc(1,1)=-1;
118 bbbc(2,2)=1/Lbc;
119 bbbc(2,3)=1/Lbc;
120 bbbc(3,2)=1;
121 bbbc(4,1)=1;
122 bbbc(5,2)=-1/Lbc;
123 bbbc(5,3)=-1/Lbc;
124 bbbc(6,3)=1;
125 bbbc
126
127 bgbc=bjbc*brbc*bbbc
128
129 Ktbc=zeros(3); %Create 3 by 3 Zero Matrix
130 Ktbc(1,1)=E*Abc/Lbc;
131 Ktbc(2,2)=4*E*Ibc/Lbc;
132 Ktbc(2,3)=2*E*Ibc/Lbc;
133 Ktbc(3,2)=2*E*Ibc/Lbc;
134 Ktbc(3,3)=4*E*Ibc/Lbc;
135 Ktbc
136
137 Kbc=bgbc*Ktbc*bgbc.'
138
139 Kbcf=Kbc;
140 Kbcf(5,:)=[]; %Deleting Row 5
141 Kbcf(:,5)=[]; %Deleting Column 5
142 Kbcf
143
144 adbc=[1/Lbc 0 0;0 6*x/(Lbc^2)-4/Lbc 6*x/(Lbc^2)-2/Lbc]
145
146 %Calculating Structure Stiffness Matrix
147 disp ('-----------------------------------------------------------------')
148 disp ('Structure Stiffness Matrix: ')
149 Kstf=Kabf+Kbcf
150
151 %Calculating Force Matrix on Elements
152 %AB Matrices: Pbwab Qwab
153 disp ('-----------------------------------------------------------------')
154 disp ('Element AB Force Matrices: ')
155 Pbwab=[0;-0.67*wab*Lab/2;0;0;-0.33*wab*Lab/2;0]
156 Qwab=[0;(-wab*Lab^2)/20;(wab*Lab^2)/30]
157
158 d0ab=[DTa*Alfa;DT*Alfa/hab]
159
160 %BC Matrices: Pbwbc
161 disp ('-----------------------------------------------------------------')
162 disp ('Element BC Force Matrices: ')
163 Pbwbc=[0;-Pbc/2;0;0;-Pbc/2;0]
164 Qwbc=[0;(-Pbc*Lbc)/8;(Pbc*Lbc)/8]
165
F:\Yazd Uni-96-Winter\Nonlinear Analysis\Example 5,6\Example8.m Page 4
166 d0bc=[DTa*Alfa;DT*Alfa/hbc]
167
168 disp ('-----------------------------------------------------------------')
169 %Step 1
170 Pst=Pnfst;
171 pstf=inv(Kstf)*Pst
172
173 %Step 2
174 pab=[0;0;0;pstf(1,1);pstf(2,1);pstf(3,1)]
175 pbc=[pstf(1,1);pstf(2,1);pstf(3,1);pstf(4,1);0;pstf(5,1)]
176
177 %Step 3
178 qab=bgab.'*pab
179 qbc=bgbc.'*pbc
180
181 %Step 4
182 dab=adab*qab+d0ab
183 dbc=adbc*qbc+d0bc
184
185 %step 5
186 epsab=as*dab
187 epsbc=as*dbc
188
189 %step 6
190 strab=E*epsab
191 strbc=E*epsbc
192
193 %step 7
194 fab=as.'*strab;
195 Dab(1,1)=bab*int(fab(1,1),y,-hab/2,hab/2);
196 Dab(2,1)=bab*int(fab(2,1),y,-hab/2,hab/2);
197 Dab
198
199 fbc=as.'*strbc;
200 Dbc(1,1)=bbc*int(fbc(1,1),y,-hbc/2,hbc/2);
201 Dbc(2,1)=bbc*int(fbc(2,1),y,-hbc/2,hbc/2);
202 Dbc
203
204 %step 8
205 gab=adab.'*Dab;
206 Qab(1,1)=int(gab(1,1),x,0,Lab);
207 Qab(2,1)=int(gab(2,1),x,0,Lab);
208 Qab(3,1)=int(gab(3,1),x,0,Lab);
209 Qab=Qab+Qwab
210
211 gbc=adbc.'*Dbc;
212 Qbc(1,1)=int(gbc(1,1),x,0,Lbc);
213 Qbc(2,1)=int(gbc(2,1),x,0,Lbc);
214 Qbc(3,1)=int(gbc(3,1),x,0,Lbc);
215 Qbc=Qbc+Qwbc
216
217 %step 9
218 Pab=bgab*Qab+bjab*brab*Pbwab;
219 Pbc=bgbc*Qbc+bjbc*brbc*Pbwbc;
220
F:\Yazd Uni-96-Winter\Nonlinear Analysis\Example 5,6\Example8.m Page 5
221 Pabf=[Pab(4,1);Pab(5,1);Pab(6,1);0;0]
222 Pbcf=[Pab(1,1);Pab(2,1);Pab(3,1);Pab(4,1);Pab(5,1)]
223
224 %step 10
225 Pst=-(Pabf+Pbcf)
226
227 %step 11
228 pstf=eval(inv(Kstf)*Pst)
229
230
231