You are on page 1of 7

12/24/2022 Open Ended Activity

Mathematics -IV Lab


GS-301L

Submitted By Received By
Name: Muhammad Abdullah Name: Muhammad Naeem Khan
Reg #: 938-FET/BSME/F20 Signature: ___________________
Date: ____________________ Date: _______________________
Engr. Muhammad Naeem Khan Open Ended Activity

Contents
Question ....................................................................................................................................................... 2
Solution ........................................................................................................................................................ 2
MATLAB Code ........................................................................................................................................... 4
OUTPUT ...................................................................................................................................................... 6

Department Of Mechanical Engineering & Technology

December 24, 2022 1


Engr. Muhammad Naeem Khan Open Ended Activity

Question
For the spring assemblage with arbitrarily numbered nodes shown in Figure 2–9, obtain

a. the global stiffness matrix,


b. The displacements of nodes 3 and 4,
c. The reaction forces at nodes 1 and 2, and
The forces in each spring. A force of 5000 lb is applied at node 4 in the x direction. The spring
constants are given in the figure. Nodes 1 and 2 are fixed.

Solution

a. We begin by making use of Equation to express each element stiffness matrix as follows:

[𝑘] = [ 𝑘 −𝑘
]
−𝑘 𝑘

[𝑘1 ] = [ 1000 −1000


]
−1000 1000

[𝑘 2 ] = [ 2000 −2000
]
−2000 2000

[𝑘 3 ] = [ 3000 −3000
]
−3000 3000
where the numbers above the columns and next to each row indicate the nodal degrees of freedom
associated with each element. For instance, element 1 is associated with degrees of freedom u1
and u3. Also, the local element x axis coincides with the global x axis for each element. Using the
concept of superposition (the direct stiffness method), we obtain the global stiffness matrix as
[K] =[k1] + [k2] + [k3]

1000 0 −1000 0
0 3000 0 −3000
[𝐾] = [ ]
−1000 0 1000 + 2000 −2000
0 −3000 −2000 3000 + 2000

Department Of Mechanical Engineering & Technology

December 24, 2022 2


Engr. Muhammad Naeem Khan Open Ended Activity

b. The global stiffness matrix, Equation, relates global forces to global dis placements as
follows:
𝐹1𝑥 1000 0 −1000 0 𝑢1
𝐹2𝑥 0 3000 0 −3000 𝑢2
{ }=[ ] {𝑢 }
𝐹3𝑥 −1000 0 1000 + 2000 −2000 3
𝐹4𝑥 0 −3000 −2000 3000 + 2000 𝑢4
Applying the homogeneous boundary conditions u1 = 0 and u2 = 0 to Equation, substituting applied
nodal forces, and partitioning the first two equations of Equation (or deleting the first two rows of
[F] and [d] and the first two rows and columns of [K] corresponding to the zero-displacement
boundary conditions), we obtain
0 3000 −2000 𝑢3
{ }=[ ]{ }
5000 −2000 −5000 𝑢4
Solving Equation, we obtain the global nodal displacements
10
𝑢3 = 𝑖𝑛
11
15
𝑢4 = 𝑖𝑛
11
c. To obtain the global nodal forces (which include the reactions at nodes 1and 2), we back-
substitute Equation and the boundary conditions u1 = 0 and u2 = 0 into Equation. This
substitution yields
0
𝐹1𝑥 1000 0 −1000 0 0
𝐹2𝑥 0 3000 0 −3000 10
{ }=[ ]
𝐹3𝑥 −1000 0 1000 + 2000 −2000 11
𝐹4𝑥 0 −3000 −2000 3000 + 2000 15
{11}
Multiplying matrices in Equation and simplifying, we obtain the forces at each node
−10000
𝐹1𝑥 = 𝑙𝑏
11
−45000
𝐹2𝑥 = 𝑙𝑏
11
𝐹3𝑥 = 0𝑙𝑏
55000
𝐹4𝑥 = 𝑙𝑏
11

Department Of Mechanical Engineering & Technology

December 24, 2022 3


Engr. Muhammad Naeem Khan Open Ended Activity

From these results, we observe that the sum of the reactions F1x and F2x is equal in magnitude but
opposite in direction to the applied force F4x. This result verifies equilibrium of the whole spring
assemblage.

MATLAB Code
1. clear
2. clc
3. format short g
4. %% Asking for Element properties
5. % No. of nodes
6. n=4;
7. % Element connectivity
8. Elements=[1 3;3 4;4 2];
9. [N,i]=size(Elements);
10. % Stiffness of elements
11. k1=1000;
12. k2=2000;
13. k3=3000;
14. k=[k1 k2 k3]';
15. %
16. Stiffness_k=k;
17. Element=[1:N]';
18. Connectivity=Elements;
19. fprintf('Given, no. of nodes = %d',n)
20. fprintf('\nNo. of elements = %d\n\n',N)
21. fprintf('Units are in inch, lb\n')
22. disp(table(Element, Connectivity, Stiffness_k))
23. %% Stiffness Matrix
24. for i=1:N
25. K{i}=k(i)*[1 -1;-1 1];
26. fprintf('Stiffness matrix of Element-%d\n',i)
27. disp(K{i})
28. end

29. %% Global Stiffness matrix


30. for i=1:N
31. Kk{i}=zeros(n,n);
32. j=Elements(i,1);
33. k=Elements(i,2);
34. Kk{i}(j,j)=K{i}(1,1);
35. Kk{i}(j,k)=K{i}(1,2);
36. Kk{i}(k,j)=K{i}(2,1);
37. Kk{i}(k,k)=K{i}(2,2);
38. end
39. KK=zeros(n,n);
40. for i=1:N
41. KK=KK+Kk{i};
42. end
43. GK=KK;
44. fprintf('\nGLOBAL STIFFNESS MATRIX [K] = \n\n');
45. disp(GK);
46. %%
47. % load on nodes
Department Of Mechanical Engineering & Technology

December 24, 2022 4


Engr. Muhammad Naeem Khan Open Ended Activity

48. F=[0 0 0 5000]';


49. fprintf('Force vector [F] is\n\n');
50. disp(F)
51. %% Displacements
52. % fixed boundary condition
53. node=[1,2];
54. q=length(node);
55. for i=node(1:1:q)
56. u(i)=0;
57. KK(i,:)=0;
58. KK(:,i)=0;
59. KK(i,i)=1;
60. F(i)=0;
61. end
62. %% Calculating deflection
63. d=KK\F;
64. fprintf('\n')
65. % Displacement vector
66. fprintf('Displacement vector [U] is\n\n');
67. disp(d)
68. % Reaction forces
69. RF=GK*d;
70. fprintf('Reaction Force [RF] = K*U is\n\n');
71. disp(RF)

Department Of Mechanical Engineering & Technology

December 24, 2022 5


Engr. Muhammad Naeem Khan Open Ended Activity

OUTPUT
Given, no. of nodes = 4
No. of elements = 3

Units are in inch, lb


Element Connectivity Stiffness_k
_______ ____________ ___________

1 1 3 1000
2 3 4 2000
3 4 2 3000

Stiffness matrix of Element-1


1000 -1000
-1000 1000

Stiffness matrix of Element-2


2000 -2000
-2000 2000

Stiffness matrix of Element-3


3000 -3000
-3000 3000

GLOBAL STIFFNESS MATRIX [K] =

1000 0 -1000 0
0 3000 0 -3000
-1000 0 3000 -2000
0 -3000 -2000 5000

Force vector [F] is

0
0
0
5000

Displacement vector [U] is

0
0
0.90909
1.3636

Reaction Force [RF] = K*U is

-909.09
-4090.9
-4.5475e-13
5000
Department Of Mechanical Engineering & Technology

December 24, 2022 6

You might also like