User:Eml4500.f08.team.foskey.ckf/HW4

Solving The Three Bar Truss Problem With MATLAB
As done earlier, MATLAB can be used to solve a three bar truss problem. Using previous MATLAB programs that solve and plot a two bar truss for inspiration, a new MATLAB program was written to solve for and plot the new three bar truss. A five bar truss problem from the textbook was also examined prior to writing the code for the three bar truss problem. The earlier programs can be seen here: Program for plotting the two bar truss Program for solving for displacements and reactions of two bar truss (see section 15 - MATLAB)

MATLAB Code
The MATLAB code needed to accomplish several tasks. First, it must solve for the displacements and reactions for the global nodes. Secondly, the code needed to plot the unloaded and loaded trusses. For this, the unloaded truss was plotted with a dotted line, and the loaded, deformed truss was plotted in solid lines. Global node numbers were labeled slightly to the left of the nodes, and the element numbers were labeled slightly to the left of the middle of the elements.

Main Function
The following is the code for the main portion of the MATLAB program. The first half of the program calculates the reactions and the displacements of the three bar truss, while the second half plots the unloaded, unreformed truss and the loaded, deformed truss. Comments throughout the program code describe what some portions of the code accomplish.

Subroutines
The following subroutines were provided earlier with the code that solves for the reactions and displacements of the two bar truss. The first part of the above main program uses these functions.

Results
Running the above MATLAB code generates the following results. (NOTE: The following results are not the direct MATLAB output. Rather, the output has been reentered in a more understandable form using the math functions offered by Media-WIKI.  Also, the names of the stiffness matrices have been changed slightly to reduce ambiguity and to better show the elements that they relate to.)

$$ k_{local}^{(1)} = \begin{bmatrix}

1.2      &  -1.2\\         -1.2        &  1.2\\ \end{bmatrix} $$ $$

k^{(1)} =\begin{bmatrix}

0.9 &    0.51962  &       -0.9&     -0.51962\\      0.51962  &        0.3   &  -0.51962 &        -0.3\\         -0.9   &  -0.51962    &      0.9  &    0.51962\\     -0.51962    &     -0.3     & 0.51962   &       0.3\\ \end{bmatrix} $$ $$

k_{local}^{(2)} =\begin{bmatrix}

0.8    &    -0.8\\         -0.8      &    0.8\\ \end{bmatrix}

$$ $$ k^{(2)} =\begin{bmatrix}

0.6 &   -0.34641   &      -0.6&      0.34641\\     -0.34641   &       0.2  &    0.34641 &        -0.2\\         -0.6    &  0.34641 &         0.6  &   -0.34641\\      0.34641     &    -0.2&     -0.34641   &       0.2\\ \end{bmatrix} $$ $$ k_{local}^{(3)} =\begin{bmatrix}

0.6     &   -0.6\\         -0.6       &   0.6\\ \end{bmatrix} $$ $$ k^{(3)} =\begin{bmatrix}

0.3&         0.3   &      -0.3&         -0.3\\          0.3 &         0.3  &       -0.3 &        -0.3\\         -0.3  &       -0.3 &         0.3  &        0.3\\         -0.3   &      -0.3&          0.3   &       0.3\\ \end{bmatrix} $$ $$K = \begin{bmatrix}

0.9  &   0.51962&         -0.9 &    -0.51962  &          0 &           0  &          0& 0\\      0.51962    &      0.3 &    -0.51962  &       -0.3   &         0  &          0   &         0& 0\\         -0.9     &-0.51962  &        1.8   &   0.47321    &     -0.6   7   0.34641    &     -0.3& -0.3\\     -0.51962      &   -0.3   &   0.47321    &      0.8     7 0.34641    &     -0.2     &    -0.3& -0.3\\            0       &     0    &     -0.6     & 0.34641      &    0.6     &-0.34641      &      0& 0\\            0        &    0     & 0.34641      &   -0.2    & -0.34641      &    0.2       &     0& 0\\            0         &   0      &   -0.3       &  -0.3     &       0       &     0        &  0.3& 0.3\\            0          &  0       &  -0.3        & -0.3      &      0        &    0         & 0.3& 0.3\\ \end{bmatrix}$$

$$R = \begin{bmatrix}

0\\    0\\     0\\    30\\     0\\     0\\     0\\     0\\ \end{bmatrix}$$

$$d = \begin{bmatrix}

0\\           0\\      -11.674\\       44.405\\            0\\            0\\            0\\            0\\ \end{bmatrix}$$

$$reactions = \begin{bmatrix}

-12.567\\     -7.2557\\       22.387\\      -12.925\\      -9.8194\\      -9.8194\\ \end{bmatrix}$$

$$results =  \begin{bmatrix}

2.4186    &  4.8371   &    9.6742     &  7.2557     &  14.511   &    9.6742   &    14.511 \\       6.4625    &   12.925  &      25.85 &      19.387    &   38.775  &      25.85      & 38.775 \\       2.3145     &  4.6289 &      9.2578  &     6.9434   &    13.887   &    9.2578     &  13.887 \\ \end{bmatrix}$$

Where : klocal(1), klocal(2), and  klocal(3) are the local stiffness matrices of elements 1, 2, and 3 respectively k(1) , k(2), and k(3) are the stiffness matrices of elements 1, 2, and 3 respectively K is the global stiffness matrix R is the matrix representation of the applied loads d is the displacement matrix reactions is the matrix representation of the axial forces and results is a matrix composed of specific values within the elements.

Each row of the matrix results corresponds to an element (row 1 = element 2, row 2 = element 2, row 3 = element 3). The first column of results corresponds to the engineering strain in an element as defined as $$ strain = \epsilon = \frac{elongation}{length}$$, where elongation is the amount an element deforms(or elongates) under a load, and length is the length of the element before loading.

Column 2 represents the stress in element 1 as a result of the deformation of the element in that row. Columns 3 and 4 represent similar values in elements 2 and 3 respectively. The stress is calculated by stress = (modulus of Elasticity)*(strain), or $$ \sigma = E*\epsilon $$. In this manner, the number in column 2, row 2 of results is the stress in element 1 due to the elongation of element 2.

Columns 5, 6, and 7 or results represent the axial forces on the elements as a result of the elongations. In a similar manner in columns 2-4, the value at column "C", row "R" corresponds to the force in element "C-4" as a result of the elongation of element "R". Since stress is defined as the force over a cross sectional area, the force can be found using

$$ stress = \frac{force}{area} \Rightarrow \sigma = \frac{F}{A}$$

$$force = stress*area \Rightarrow F= \sigma*A$$

The Resulting Figure
After running the MATLAB program, the resulting figure shows the unloaded, undeformed truss with dotted lines, and the loaded, deformed truss as solid lines. Global node 1 is placed at the origin.



The unloaded, undeformed truss is shown in red dotted lines. The global node numbers for this truss are shown in green. The element numbers are shown in black, and are located to the left of the midpoints of the elements.

The loaded, deformed truss is shown in solid blue lines. The global nodes 1, 3, and 4 are the same as the undeformed truss (in green), as these points are fixed. Global node 2 is not fixed and is displaced upon loading. The displaced global node 2 is shown in blue. The deformed elements are labeled in light blue, slightly to the left of the midpoints of their respective elements.