Professional Documents
Culture Documents
Problem
Write a program in MATLAB (or any preferred Programming Language)
to find the displacements in the following system.
F 3 = 3 units
I F 6 = 6units
Clearing Workspace
Use of "Clear" command, usually slows down the performance of code. However, for evaluation purpose, the command is of great
significance.
clc
clear all;
Geometric Parameters
Total Length of system = 5 units
Area of cross-section for each Spring = 1 units
Material Properties
Element Stiffness for each Spring = 100 units
Young's Modulus of Elasticity for each Spring = 1 units
Discretization Details
Number of nodes per element = 2
Degree of Freedom at each node = 1
Initial global node number= IEN (local node number, element number )
IEN = [1:No_of_elements;2:No_of_elements+l]
IEN =
1 2 3 4 5
2 3 4 5 6
ID =
0 1 2 3 4 5
LM =
0 1 2 3 4
1 2 3 4 5
for j= 1:No_of_global_nodes
if Overall_displacement_vector(j,i) 0
else
for ii= No_DOF_per_node
for jj= 1:No_of_global_nodes - No_of_constraint_nodes
Displacement_vector(jj,ii)= 0;
end
end
end
end
end
Displacement_vector
Displacement_vector=
0
0
0
0
0
Finally, displacement vector is ready for further utlization after truncation of the known displacements.
Construction of Displacement Vector
Similarly, the overall force vector also needs to be truncated for the known reaction at known displacement nodes. Elements of overall
force vector with "O" are showing locations of known reaction/s and elements with "1" are showing absence of any known external loads.
F= Overall_displacement_vector;
F(3,1)= 3; %%%%%%%% Change, This change is associated with change in Natural Boundary Conditions Column%%%%%%%%
F(6,l)= 6; %%%%%%%% Change, This change is associated with change in Natural Boundary Conditions Column%%%%%%%%
Overall_force_vector= F
Overall_force_vector=
0
1
3
1
1
6
After necessary truncation, the force vector is ready for solving system of equations.
Force_vector=
0
3
0
0
6
D_Matrix_Solved= K A -l*Force_vector;
Displacement_vector_solved= ones(No_of_global_nodes,1);