-
Notifications
You must be signed in to change notification settings - Fork 1
/
Truss26ObjFnManual.m
211 lines (194 loc) · 22.4 KB
/
Truss26ObjFnManual.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
%=========================================================================%
% This is an objective function file for optimizing the weight of 942 bar
% tower truss.
%
% The optimization is done using Grey Wolf Optimizer toolbox
% The toolbox is developed by Seyedali Mirjalili and is available on the
% website - https://seyedalimirjalili.com/gwo
%
% The lower bound (lb) is the minimum area allowed = 0.000064516
% The upper bound (ub) is the maximum area allowed = 0.0129032
% The number of variables = 59
%=========================================================================%
function z=Truss26ObjFnManual(Q)
n=244; % no of nodes
ne=942; % no of elements
ndof=3; % no of DOF's
nen=2; % no of nodes for each element
nee=nen*ndof;
Nd=0.381; % Node Displacement Limit in m
Fy=172368.932; % Stress Limit in kN/m2
% area of the elements in sq.m
ar(1,1:2)=Q(1);
ar(1,3:10)=Q(2);
ar(1,11:18)=Q(3);
ar(1,19:34)=Q(4);
ar(1,35:46)=Q(5);
ar(1,47:58)=Q(6);
ar(1,59:82)=Q(7);
ar(1,83:86)=Q(8);
ar(1,87:94)=Q(9);
ar(1,95:98)=Q(10);
ar(1,99:106)=Q(11);
ar(1,107:122)=Q(12);
ar(1,123:130)=Q(13);
ar(1,131:162)=Q(14);
ar(1,163:170)=Q(15);
ar(1,171:186)=Q(16);
ar(1,187:194)=Q(17);
ar(1,195:226)=Q(18);
ar(1,227:234)=Q(19);
ar(1,235:258)=Q(20);
ar(1,259:270)=Q(21);
ar(1,271:318)=Q(22);
ar(1,319:330)=Q(23);
ar(1,331:338)=Q(24);
ar(1,339:342)=Q(25);
ar(1,343:350)=Q(26);
ar(1,351:358)=Q(27);
ar(1,359:366)=Q(28);
ar(1,367:382)=Q(29);
ar(1,383:390)=Q(30);
ar(1,391:398)=Q(31);
ar(1,399:430)=Q(32);
ar(1,431:446)=Q(33);
ar(1,447:462)=Q(34);
ar(1,463:486)=Q(35);
ar(1,487:498)=Q(36);
ar(1,499:510)=Q(37);
ar(1,511:558)=Q(38);
ar(1,559:582)=Q(39);
ar(1,583:606)=Q(40);
ar(1,607:630)=Q(41);
ar(1,631:642)=Q(42);
ar(1,643:654)=Q(43);
ar(1,655:702)=Q(44);
ar(1,703:726)=Q(45);
ar(1,727:750)=Q(46);
ar(1,751:774)=Q(47);
ar(1,775:786)=Q(48);
ar(1,787:798)=Q(49);
ar(1,799:846)=Q(50);
ar(1,847:870)=Q(51);
ar(1,871:894)=Q(52);
ar(1,895:902)=Q(53);
ar(1,903:906)=Q(54);
ar(1,907:910)=Q(55);
ar(1,911:918)=Q(56);
ar(1,919:926)=Q(57);
ar(1,927:934)=Q(58);
ar(1,935:942)=Q(59);
fixed_dof=[697;698;699;700;701;702;703;704;705;706;707;708;709;710;711;712;713;714;715;716;717;718;719;720;721;722;723;724;725;726;727;728;729;730;731;732]; % constrained DOF's
L=[1,2,1,3,1,2,5,7,5,6,2,1,4,3,6,5,8,7,2,1,2,4,4,3,1,3,6,5,6,8,8,7,7,5,9,11,9,10,13,15,13,14,17,19,17,18,10,9,12,11,14,13,16,17,18,17,20,19,9,10,10,12,12,11,11,9,13,14,14,16,16,15,15,13,17,18,18,20,20,19,19,17,21,23,21,22,22,21,22,24,24,23,23,21,22,21,24,23,22,21,22,24,24,23,23,21,25,26,25,28,30,31,27,29,33,34,33,36,38,39,35,37,25,27,30,32,33,35,38,40,25,26,26,27,28,25,27,29,29,32,32,31,31,30,30,28,33,34,34,35,35,37,37,40,40,39,39,38,38,36,36,33,26,28,31,29,34,36,39,37,41,42,41,43,44,46,47,45,49,50,49,51,52,54,55,53,43,41,46,48,49,51,54,56,41,42,42,43,43,45,45,48,48,47,47,46,46,44,44,41,49,50,50,51,51,53,53,56,56,55,55,54,54,52,52,49,42,44,45,47,50,52,53,55,57,58,57,59,60,61,62,63,65,66,65,67,68,69,70,71,73,74,73,75,76,77,78,79,57,59,62,64,65,67,70,72,73,75,78,80,57,58,58,59,59,61,61,64,64,63,63,62,62,60,60,57,65,66,66,67,67,69,69,72,72,71,71,70,70,68,68,65,73,74,74,75,75,77,77,80,80,79,79,78,78,76,76,73,58,60,61,63,66,68,69,71,74,76,77,79,81,82,81,83,84,85,86,87,81,83,86,88,82,82,85,85,84,84,87,87,83,81,83,88,81,86,86,88,82,82,84,84,85,85,87,87,90,92,89,93,95,96,98,99,102,104,101,105,107,108,110,111,91,89,94,97,103,101,106,109,90,93,96,99,102,105,108,111,93,92,90,91,89,90,93,94,100,99,99,98,97,96,96,95,102,103,102,101,104,105,105,106,112,111,111,110,109,108,108,107,91,92,97,98,89,95,94,100,103,104,109,110,101,107,106,112,91,92,97,98,89,95,94,100,103,104,109,110,106,112,101,107,113,114,116,117,119,120,122,123,125,126,128,129,131,132,134,135,137,138,140,141,143,144,146,147,115,121,113,118,127,133,125,130,139,145,137,142,114,117,120,123,126,129,132,135,138,141,144,147,113,114,114,115,116,117,117,118,119,120,120,121,122,123,123,124,125,126,126,127,128,129,129,130,131,132,132,133,134,135,135,136,137,138,138,139,140,141,141,142,143,144,144,145,146,147,147,148,115,116,121,122,113,119,118,124,127,128,133,134,125,131,130,136,139,140,145,146,137,143,142,148,115,116,121,122,113,119,118,124,127,128,133,134,125,131,130,136,139,140,145,146,137,143,142,148,149,150,152,153,155,156,158,159,161,162,164,165,167,168,170,171,173,174,176,177,179,180,182,183,151,157,149,154,163,169,161,166,175,181,173,178,150,153,156,159,162,165,168,171,174,177,180,183,149,150,150,151,152,153,153,154,155,156,156,157,158,159,159,160,161,162,162,163,164,165,165,166,167,168,168,169,170,171,171,172,173,174,174,175,176,177,177,178,179,180,180,181,182,183,183,184,151,152,157,158,149,155,154,160,163,164,169,170,161,167,166,172,175,176,181,182,173,179,178,184,151,152,157,158,149,155,154,160,163,164,169,170,161,167,166,172,175,176,181,181,173,179,178,184,185,186,188,189,191,192,194,195,197,198,200,201,203,204,206,207,209,210,212,213,215,216,218,219,187,193,185,190,199,205,197,202,211,217,209,214,186,189,192,195,198,201,204,207,210,213,216,219,185,186,186,187,188,189,189,190,191,192,192,193,194,195,195,196,197,198,198,199,200,201,201,202,203,204,204,205,206,207,207,208,209,210,210,211,212,213,213,214,215,216,216,217,218,219,219,220,187,188,193,194,185,191,190,196,199,200,205,206,197,203,202,208,211,212,217,218,209,215,214,220,187,188,193,194,185,191,190,196,199,200,205,206,197,203,202,208,211,212,217,218,209,215,214,220,221,222,224,225,227,228,230,231,223,229,221,226,222,225,228,231,223,221,224,226,227,229,230,232,222,222,225,225,228,228,231,231,223,224,229,230,221,227,226,232,223,224,229,230,221,227,226,232;4,3,2,4,3,4,6,8,7,8,6,5,8,7,10,9,12,11,5,6,8,6,7,8,7,5,9,10,12,10,11,12,9,11,10,12,11,12,14,16,15,16,18,20,19,20,14,13,16,15,18,17,20,19,22,21,24,23,14,13,16,14,15,16,13,15,18,17,20,18,19,20,17,19,22,21,24,22,23,24,21,23,22,24,23,24,25,27,32,27,30,32,25,30,27,25,32,30,26,26,29,29,31,31,28,28,26,27,28,30,31,32,29,32,34,35,36,38,39,40,37,40,33,35,38,40,41,43,46,48,34,33,35,34,33,36,37,35,40,37,39,40,38,39,36,38,42,41,43,42,45,43,48,45,47,48,46,47,44,46,41,44,34,36,39,37,42,44,47,45,42,43,44,45,46,47,48,48,50,51,52,53,54,55,56,56,51,49,54,56,57,59,62,64,50,49,51,50,53,51,56,53,55,56,54,55,52,54,49,52,58,57,59,58,61,59,64,61,63,64,62,63,60,62,57,60,50,52,53,55,58,60,61,63,58,59,60,61,62,64,63,64,66,67,68,69,70,72,71,72,74,75,76,77,78,80,79,80,65,67,70,72,73,75,78,80,81,83,86,88,66,65,67,66,69,67,72,69,71,72,70,71,68,70,65,68,74,73,75,74,77,75,80,77,79,80,78,79,76,78,73,76,82,81,83,82,85,83,88,85,87,88,86,87,84,86,81,84,66,68,69,71,74,76,77,79,82,84,85,87,82,83,84,85,86,88,87,88,90,93,96,99,90,93,93,99,96,90,96,99,92,91,94,100,89,95,97,98,92,91,89,95,94,100,97,98,91,93,90,94,96,97,99,100,103,105,102,106,108,109,111,112,92,95,100,98,104,107,112,110,102,105,108,111,114,117,120,123,104,105,103,102,102,101,106,105,111,112,110,111,108,109,107,108,115,114,113,114,117,116,118,117,123,124,122,123,120,121,119,120,103,104,109,110,101,107,106,112,115,116,121,122,113,119,118,124,104,103,110,109,107,101,112,106,116,115,122,121,124,118,119,113,114,115,117,118,120,121,123,124,126,127,129,130,132,133,135,136,138,139,141,142,144,145,147,148,116,122,119,124,128,134,131,136,140,146,143,148,126,129,132,135,138,141,144,147,150,153,156,159,126,125,127,126,129,128,130,129,132,131,133,132,135,134,136,135,138,137,139,138,141,140,142,141,144,143,145,144,147,146,148,147,150,149,151,150,153,152,154,153,156,155,157,156,159,158,160,159,127,128,133,134,125,131,130,136,139,140,145,146,137,143,142,148,151,152,157,158,149,155,154,160,128,127,134,133,131,125,136,130,140,139,146,145,143,137,148,142,152,151,158,157,155,149,154,154,150,151,153,154,156,157,159,160,162,163,165,166,168,169,171,172,174,175,177,178,180,181,183,184,152,158,155,160,164,170,167,172,176,182,179,184,162,165,168,171,174,177,180,183,186,189,192,195,162,161,163,162,165,164,166,165,168,167,169,168,171,170,172,171,174,173,175,174,177,176,178,177,180,179,181,180,183,182,184,183,186,185,187,186,189,188,190,189,192,191,193,192,195,194,196,195,163,164,169,170,161,167,166,172,175,176,181,182,173,179,178,184,187,188,193,194,185,191,190,196,164,163,170,169,167,161,172,166,176,175,182,181,179,173,184,178,188,187,194,193,191,185,196,190,186,187,189,190,192,193,195,196,198,199,201,202,204,205,207,208,210,211,213,214,216,217,219,220,188,194,191,196,200,206,203,208,212,218,215,220,198,201,204,207,210,213,216,219,222,225,228,231,198,197,199,198,201,200,202,201,204,203,205,204,207,206,208,207,210,209,211,210,213,212,214,213,216,215,217,216,219,218,220,219,222,221,223,222,225,224,226,225,228,227,229,228,231,230,232,231,199,200,205,206,197,203,202,208,211,212,217,218,209,215,214,220,223,224,229,230,221,227,226,232,200,199,206,205,203,197,208,202,212,211,218,217,215,209,220,214,224,223,230,229,221,227,226,232,222,223,225,226,228,229,231,232,224,230,227,232,234,237,240,243,234,234,237,237,240,240,243,243,235,233,236,238,239,241,242,244,235,236,241,242,233,239,238,244,236,235,242,241,239,233,244,238]; % element connecting matrix
coord=(1/3.28084)*[24.5000000000000,38.5000000000000,24.5000000000000,38.5000000000000,24.5000000000000,38.5000000000000,24.5000000000000,38.5000000000000,24.5000000000000,38.5000000000000,24.5000000000000,38.5000000000000,24.5000000000000,38.5000000000000,24.5000000000000,38.5000000000000,24.5000000000000,38.5000000000000,24.5000000000000,38.5000000000000,24.5000000000000,38.5000000000000,24.5000000000000,38.5000000000000,21.6005000000000,31.5000000000000,41.3995000000000,17.5000000000000,45.5000000000000,21.6005000000000,31.5000000000000,41.3995000000000,21.6005000000000,31.5000000000000,41.3995000000000,17.5000000000000,45.5000000000000,21.6005000000000,31.5000000000000,41.3995000000000,21.6005000000000,31.5000000000000,41.3995000000000,17.5000000000000,45.5000000000000,21.6005000000000,31.5000000000000,41.3995000000000,21.6005000000000,31.5000000000000,41.3995000000000,17.5000000000000,45.5000000000000,21.6005000000000,31.5000000000000,41.3995000000000,21.6005000000000,31.5000000000000,41.3995000000000,17.5000000000000,45.5000000000000,21.6005000000000,31.5000000000000,41.3995000000000,21.6005000000000,31.5000000000000,41.3995000000000,17.5000000000000,45.5000000000000,21.6005000000000,31.5000000000000,41.3995000000000,21.6005000000000,31.5000000000000,41.3995000000000,17.5000000000000,45.5000000000000,21.6005000000000,31.5000000000000,41.3995000000000,21.6005000000000,31.5000000000000,41.3995000000000,17.5000000000000,45.5000000000000,21.6005000000000,31.5000000000000,41.3995000000000,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,0,3.50000000000000,24.5000000000000,38.5000000000000,59.5000000000000,63,0,3.50000000000000,24.5000000000000,38.5000000000000,59.5000000000000,63;24.5000000000000,24.5000000000000,38.5000000000000,38.5000000000000,24.5000000000000,24.5000000000000,38.5000000000000,38.5000000000000,24.5000000000000,24.5000000000000,38.5000000000000,38.5000000000000,24.5000000000000,24.5000000000000,38.5000000000000,38.5000000000000,24.5000000000000,24.5000000000000,38.5000000000000,38.5000000000000,24.5000000000000,24.5000000000000,38.5000000000000,38.5000000000000,21.6005000000000,17.5000000000000,21.6005000000000,31.5000000000000,31.5000000000000,41.3995000000000,45.5000000000000,41.3995000000000,21.6005000000000,17.5000000000000,21.6005000000000,31.5000000000000,31.5000000000000,41.3995000000000,45.5000000000000,41.3995000000000,21.6005000000000,17.5000000000000,21.6005000000000,31.5000000000000,31.5000000000000,41.3995000000000,45.5000000000000,41.3995000000000,21.6005000000000,17.5000000000000,21.6005000000000,31.5000000000000,31.5000000000000,41.3995000000000,45.5000000000000,41.3995000000000,21.6005000000000,17.5000000000000,21.6005000000000,31.5000000000000,31.5000000000000,41.3995000000000,45.5000000000000,41.3995000000000,21.6005000000000,17.5000000000000,21.6005000000000,31.5000000000000,31.5000000000000,41.3995000000000,45.5000000000000,41.3995000000000,21.6005000000000,17.5000000000000,21.6005000000000,31.5000000000000,31.5000000000000,41.3995000000000,45.5000000000000,41.3995000000000,21.6005000000000,17.5000000000000,21.6005000000000,31.5000000000000,31.5000000000000,41.3995000000000,45.5000000000000,41.3995000000000,24.5000000000000,11.1199000000000,7,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,56,51.8801000000000,38.5000000000000,24.5000000000000,11.1199000000000,7,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,56,51.8801000000000,38.5000000000000,24.5000000000000,11.1199000000000,7,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,56,51.8801000000000,38.5000000000000,24.5000000000000,11.1199000000000,7,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,56,51.8801000000000,38.5000000000000,24.5000000000000,11.1199000000000,7,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,56,51.8801000000000,38.5000000000000,24.5000000000000,11.1199000000000,7,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,56,51.8801000000000,38.5000000000000,24.5000000000000,11.1199000000000,7,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,56,51.8801000000000,38.5000000000000,24.5000000000000,11.1199000000000,7,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,56,51.8801000000000,38.5000000000000,24.5000000000000,11.1199000000000,7,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,56,51.8801000000000,38.5000000000000,24.5000000000000,11.1199000000000,7,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,56,51.8801000000000,38.5000000000000,24.5000000000000,11.1199000000000,7,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,56,51.8801000000000,38.5000000000000,24.5000000000000,11.1199000000000,7,7,11.1199000000000,24.5000000000000,38.5000000000000,51.8801000000000,56,56,51.8801000000000,38.5000000000000,24.5000000000000,3.50000000000000,0,0,3.50000000000000,24.5000000000000,38.5000000000000,59.5000000000000,63,63,59.5000000000000,38.5000000000000;312,312,312,312,300,300,300,300,288,288,288,288,276,276,276,276,264,264,264,264,252,252,252,252,240,240,240,240,240,240,240,240,228,228,228,228,228,228,228,228,216,216,216,216,216,216,216,216,204,204,204,204,204,204,204,204,192,192,192,192,192,192,192,192,180,180,180,180,180,180,180,180,168,168,168,168,168,168,168,168,156,156,156,156,156,156,156,156,144,144,144,144,144,144,144,144,144,144,144,144,132,132,132,132,132,132,132,132,132,132,132,132,120,120,120,120,120,120,120,120,120,120,120,120,108,108,108,108,108,108,108,108,108,108,108,108,96,96,96,96,96,96,96,96,96,96,96,96,84,84,84,84,84,84,84,84,84,84,84,84,72,72,72,72,72,72,72,72,72,72,72,72,60,60,60,60,60,60,60,60,60,60,60,60,48,48,48,48,48,48,48,48,48,48,48,48,36,36,36,36,36,36,36,36,36,36,36,36,24,24,24,24,24,24,24,24,24,24,24,24,12,12,12,12,12,12,12,12,12,12,12,12,0,0,0,0,0,0,0,0,0,0,0,0]; % coordinate vector for the 244 nodes in ft (x,y(ht),z)
% coord in m
load=4.448*[1.50000000000000;-1;-3;-1;-1;-3;1.50000000000000;-1;-3;-1;1;-3;1.50000000000000;-1;-3;-1;-1;-3;1.50000000000000;-1;-3;-1;1;-3;1.50000000000000;-1;-3;-1;-1;-3;1.50000000000000;-1;-3;-1;1;-3;1.50000000000000;-1;-3;-1;-1;-3;1.50000000000000;-1;-3;-1;1;-3;1.50000000000000;-1;-3;-1;-1;-3;1.50000000000000;-1;-3;-1;1;-3;1.50000000000000;-1;-3;-1;-1;-3;1.50000000000000;-1;-3;-1;1;-3;1.50000000000000;-1;-3;0;-1;-3;-1;-1;-3;1.50000000000000;0;-3;-1;0;-3;1.50000000000000;1;-3;0;1;-3;-1;1;-3;1.50000000000000;-1;-6;0;-1;-6;-1;-1;-6;1.50000000000000;0;-6;-1;0;-6;1.50000000000000;1;-6;0;1;-6;-1;1;-6;1.50000000000000;-1;-6;0;-1;-6;-1;-1;-6;1.50000000000000;0;-6;-1;0;-6;1.50000000000000;1;-6;0;1;-6;-1;1;-6;1.50000000000000;-1;-6;0;-1;-6;-1;-1;-6;1.50000000000000;0;-6;-1;0;-6;1.50000000000000;1;-6;0;1;-6;-1;1;-6;1.50000000000000;-1;-6;0;-1;-6;-1;-1;-6;1.50000000000000;0;-6;-1;0;-6;1.50000000000000;1;-6;0;1;-6;-1;1;-6;1.50000000000000;-1;-6;0;-1;-6;-1;-1;-6;1.50000000000000;0;-6;-1;0;-6;1.50000000000000;1;-6;0;1;-6;-1;1;-6;1.50000000000000;-1;-6;0;-1;-6;-1;-1;-6;1.50000000000000;0;-6;-1;0;-6;1.50000000000000;1;-6;0;1;-6;-1;1;-6;1.50000000000000;-1;-6;0;-1;-6;-1;-1;-6;1.50000000000000;0;-6;-1;0;-6;1.50000000000000;1;-6;0;1;-6;-1;1;-6;1.50000000000000;-1;-6;1.50000000000000;-1;-6;1.50000000000000;-1;-6;-1;-1;-6;-1;-1;-6;-1;-1;-6;1.50000000000000;1;-6;1.50000000000000;1;-6;1.50000000000000;1;-6;-1;1;-6;-1;1;-6;-1;1;-6;1.50000000000000;-1;-9;1.50000000000000;-1;-9;1.50000000000000;-1;-9;-1;-1;-9;-1;-1;-9;-1;-1;-9;1.50000000000000;1;-9;1.50000000000000;1;-9;1.50000000000000;1;-9;-1;1;-9;-1;1;-9;-1;1;-9;1.50000000000000;-1;-9;1.50000000000000;-1;-9;1.50000000000000;-1;-9;-1;-1;-9;-1;-1;-9;-1;-1;-9;1.50000000000000;1;-9;1.50000000000000;1;-9;1.50000000000000;1;-9;-1;1;-9;-1;1;-9;-1;1;-9;1.50000000000000;-1;-9;1.50000000000000;-1;-9;1.50000000000000;-1;-9;-1;-1;-9;-1;-1;-9;-1;-1;-9;1.50000000000000;1;-9;1.50000000000000;1;-9;1.50000000000000;1;-9;-1;1;-9;-1;1;-9;-1;1;-9;1.50000000000000;-1;-9;1.50000000000000;-1;-9;1.50000000000000;-1;-9;-1;-1;-9;-1;-1;-9;-1;-1;-9;1.50000000000000;1;-9;1.50000000000000;1;-9;1.50000000000000;1;-9;-1;1;-9;-1;1;-9;-1;1;-9;1.50000000000000;-1;-9;1.50000000000000;-1;-9;1.50000000000000;-1;-9;-1;-1;-9;-1;-1;-9;-1;-1;-9;1.50000000000000;1;-9;1.50000000000000;1;-9;1.50000000000000;1;-9;-1;1;-9;-1;1;-9;-1;1;-9;1.50000000000000;-1;-9;1.50000000000000;-1;-9;1.50000000000000;-1;-9;-1;-1;-9;-1;-1;-9;-1;-1;-9;1.50000000000000;1;-9;1.50000000000000;1;-9;1.50000000000000;1;-9;-1;1;-9;-1;1;-9;-1;1;-9;1.50000000000000;-1;-9;1.50000000000000;-1;-9;1.50000000000000;-1;-9;-1;-1;-9;-1;-1;-9;-1;-1;-9;1.50000000000000;1;-9;1.50000000000000;1;-9;1.50000000000000;1;-9;-1;1;-9;-1;1;-9;-1;1;-9;1.50000000000000;-1;-9;1.50000000000000;-1;-9;1.50000000000000;-1;-9;-1;-1;-9;-1;-1;-9;-1;-1;-9;1.50000000000000;1;-9;1.50000000000000;1;-9;1.50000000000000;1;-9;-1;1;-9;-1;1;-9;-1;1;-9;1.50000000000000;-1;-9;1.50000000000000;-1;-9;1.50000000000000;-1;-9;-1;-1;-9;-1;-1;-9;-1;-1;-9;1.50000000000000;1;-9;1.50000000000000;1;-9;1.50000000000000;1;-9;-1;1;-9;-1;1;-9;-1;1;-9;1.50000000000000;-1;-9;1.50000000000000;-1;-9;1.50000000000000;-1;-9;-1;-1;-9;-1;-1;-9;-1;-1;-9;1.50000000000000;1;-9;1.50000000000000;1;-9;1.50000000000000;1;-9;-1;1;-9;-1;1;-9;-1;1;-9;1.50000000000000;-1;-9;1.50000000000000;-1;-9;1.50000000000000;-1;-9;-1;-1;-9;-1;-1;-9;-1;-1;-9;1.50000000000000;1;-9;1.50000000000000;1;-9;1.50000000000000;1;-9;-1;1;-9;-1;1;-9;-1;1;-9]; % load vector
% load in kN
E=68947572.93178299; % youngs modulus kN/m2
den=27.1447; % density of material in kN/m3
%% Calculation
%getting the ID matrix from the information given
ID=zeros(ndof,n);
r=size(ID);
c=r(1,2); %no of nodes
r=r(1,1); %dof
number=1;
for c1=1:c
for r1=1:r
ID(r1,c1)=number;
number=number+1;
end
end
fixed_dof=sort(fixed_dof);
fixed1=fixed_dof;
node=1:1:n*ndof;
free_dof=node;
for i=1:length(fixed_dof)
free_dof(fixed1(i))=[];
fixed1=fixed1-1; %to remove fixed dof otherwise will be 2,4,6,...
end
clear fixed1;
free_dof=sort(free_dof);
free_dof=free_dof';
for e=1:ne
for i=1:nen
for a=1:ndof
p=ndof*(i-1)+a;
LM(p,e)=ID(a,L(i,e));
end
end
end
K=zeros(n*ndof);
lambda_vec=[];
h_vec=[];
%assembly
for e=1:ne %coordinates matrix of each element
localcoord=[coord(:,L(1,e)) coord(:,L(2,e))];
h=0;
for count=1:ndof %length of member
temp=(localcoord(count,2)-localcoord(count,1))^2;
h=h+temp;
end
h=sqrt(h);
h_vec=[h_vec;h];
lambda=[];
for count=1:ndof %direction cosines in lambda matrix like cosx
lambda=[lambda;(localcoord(count,2)-localcoord(count,1))/h];
%first one is lambda x ans second one is lambda y and so on
end
lambda_vec=[lambda_vec lambda];
A=lambda*lambda';
k=(E*ar(e))/h*[A -A;-A A];
for p=1:nee
P=LM(p,e);
for q=1:nee
Q=LM(q,e);
K(P,Q)=K(P,Q)+k(p,q); % Global Stiffness matrix
end
end
end
lambda_vec=lambda_vec';
K1=K;
%applying boundary conditions
for counter=1:length(fixed_dof)
K1(fixed_dof(counter),:)=[];
K1(:,fixed_dof(counter))=[];
fixed_dof=fixed_dof-1;
end
load1=load(1:696);
d=K1\load1;
disp_vec=zeros(n*ndof,1);
for count=1:length(free_dof)
disp_vec(free_dof(count))=d(count);
end
%% Weight
TW=0;
for i=1:ne
W=den*ar(i)*h_vec(i);
TW=TW+W; % weight in kN
end
%% post processing
D_big=[];
count=1;
for i=1:n
D=[];
for j=1:ndof
t=disp_vec(count);
count=count+1;
D=[D;t];
end
D_big=[D_big D];
end
axial_vec=[];
force_vec=[];
for i=1:ne
d1=lambda_vec(i,:)*D_big(:,L(1,i));
d2=lambda_vec(i,:)*D_big(:,L(2,i));
axial=(E/h_vec(i))*(d2-d1);
axial_vec=[axial_vec;axial];
force=ar(i)*axial_vec(i);
force_vec=[force_vec;force];
end
axial_vec;
z=TW+sum(max(abs(disp_vec)-Nd*ones(732,1),zeros(732,1)))+sum(max(axial_vec-(Fy*ones(942,1)),zeros(942,1)));
end