0% found this document useful (0 votes)
3 views2 pages

Assignment

The document outlines a MATLAB script for assembling a global stiffness matrix for a system of nodes with defined stiffness constraints. It calculates nodal displacements and reactions at supports based on applied forces and boundary conditions. The results include the nodal displacement vector and the reaction forces at the fixed supports.

Uploaded by

Joe le chaud
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Assignment

The document outlines a MATLAB script for assembling a global stiffness matrix for a system of nodes with defined stiffness constraints. It calculates nodal displacements and reactions at supports based on applied forces and boundary conditions. The results include the nodal displacement vector and the reaction forces at the fixed supports.

Uploaded by

Joe le chaud
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

1 % Stiffness Constraints (lb/in)

2 k1 = 60;
3 k2 = 80;
4 k3 = 100;
5 k4 = 120;
6 k5 = 150;
7 k6 = 180;
8 % Number of nodes
9 nNodes = 5;
10 K = zeros(nNodes); % Global Stiffness Matrix
11 % Assembly of Elements Stiffness Matrices
12 % k1 between nodes 1 and 2
13 K(1,1) = K(1,1) + k1;
14 K(1,2) = K(1,2) - k1;
15 K(2,1) = K(2,1) - k1;
16 K(2,2) = K(2,2) + k1;
17 % k2 between nodes 2 and 3
18 K(2,2) = K(2,2) + k2;
19 K(2,3) = K(2,3) - k2;
20 K(3,2) = K(3,2) - k2;
21 K(3,3) = K(3,3) + k2;
22 % k3 between nodes 2 and 3 as well
23 K(2,2) = K(2,2) + k3;
24 K(2,3) = K(2,3) - k3;
25 K(3,2) = K(3,2) - k3;
26 K(3,3) = K(3,3) + k3;
27 % k4 between nodes 2 and 4
28 K(2,2) = K(2,2) + k4;
29 K(2,4) = K(2,4) - k4;
30 K(4,2) = K(4,2) - k4;
31 K(4,4) = K(4,4) + k4;
32 % k5 between nodes 3 and 4
33 K(3,3) = K(3,3) + k5;
34 K(3,4) = K(3,4) - k5;
35 K(4,3) = K(4,3) - k5;
36 K(4,4) = K(4,4) + k5;
37 % k6 between nodes 4 and 5
38 K(4,4) = K(4,4) + k6;
39 K(4,5) = K(4,5) - k6;
40 K(5,4) = K(5,4) - k6;
41 K(5,5) = K(5,5) + k6;
42 % Vector of nodal forces
43 P = zeros(nNodes,1);
44 P(2) = 100;
45 P(4) = 80;
46 % Boundary Conditions (nodes 1 and 5 are fixed)
47 fixedNodes = [1;5];
48 freeNodes = setdiff(1:nNodes, f**5** ...
49 ixedNodes);
50 % Matrix Partitioning
51 K_reduced = K(freeNodes, freeNodes);
52 P_reduced = P(freeNodes);
53 % Obtaining displacements
54 U = zeros(nNodes, 1);
55 U(freeNodes) = K_reduced \ P_reduced;
56 % Reaction at supports
57 R = K * U - P
58 % Results
59 disp('Nodal displacement U = ');
60 disp(U);
61 disp('Reaction at the supports R = ');
62 disp(R);
>> Example1
R =
-55.0276
-0.0000
0.0000
0
-124.9724
Nodal displacement U =
0
0.9171
0.8158
0.6943
0
Reaction at the supports R =
-55.0276
-0.0000
0.0000
0
-124.9724
>>

You might also like