User:Eml4500.f08.lulz.strack/hw2

Element stiffness matrix
$$ \bar{k}^{(e)}= \begin{bmatrix} k_{11}^{(e)} & k_{12}^{(e)} & k_{13}^{(e)} & k_{14}^{(e)} \\ k_{21}^{(e)} & k_{22}^{(e)} & k_{23}^{(e)} & k_{24}^{(e)} \\ k_{31}^{(e)} & k_{32}^{(e)} & k_{33}^{(e)} & k_{34}^{(e)} \\ k_{41}^{(e)} & k_{42}^{(e)} & k_{43}^{(e)} & k_{44}^{(e)} \end{bmatrix}; e = 1,2 $$

For an elastic bar element:

$$ \bar{k}^{(e)}= K^{(e)} \begin{bmatrix} (l^{(e)})^2 & l^{(e)}m^{(e)} & -(l^{(e)})^2 & -l^{(e)}m^{(e)} \\ l^{(e)}m^{(e)} & (m^{(e)})^2 & -l^{(e)}m^{(e)} & -(m^{(e)})^2 \\ -(l^{(e)})^2 & -l^{(e)}m^{(e)} & (l^{(e)})^2 & l^{(e)}m^{(e)} \\ -l^{(e)}m^{(e)} & -(m^{(e)})^2 & l^{(e)}m^{(e)} & (m^{(e)})^2 \end{bmatrix}; K^{(e)} = \frac{E^{(e)}A^{(e)}}{L^{(e)}} $$

$$ l^{(e)} = \frac{(x_j-x_i)}{L^{(e)}}; m^{(e)} = \frac{(y_j-y_i)}{L^{(e)}} $$

Where x and y are the global coordinates of the nodes i and j at either end of the bar element.

Using MATLAB
Global coordinates of nodes:

nodes = [x1, y1; x2, y2; x3, y3];

>> nodes = [0, 0; 4*cos(pi/6) 4*sin(pi/6); 4*cos(pi/6)+2*cos(pi/4) 4*sin(pi/6)-2*sin(pi/4)]

nodes =

0           0       3.4641            2       4.8783      0.58579

Directional forces l and m: >> l_1 = (3.4641-0)/4

l_1 =

0.86603

>> m_1 = (2-0)/4

m_1 =

0.5

>> l_2 = (4.8783-3.4641)/2

l_2 =

0.7071

>> m_2 = (0.5858-2)/2

m_2 =

-0.7071

Elemental Stiffness Matrices: >> k_1 = 3*1/4*[l_1^2 l_1*m_1 -l_1^2 -l_1*m_1; l_1*m_1 m_1^2 -l_1*m_1 -m_1^2; -l_1^2 -l_1*m_1 l_1^2 l_1*m_1; -l_1*m_1 -m_1^2 l_1*m_1 m_1^2]

k_1 =

0.5625     0.32476      -0.5625     -0.32476      0.32476       0.1875     -0.32476      -0.1875      -0.5625     -0.32476       0.5625      0.32476     -0.32476      -0.1875      0.32476       0.1875

>> k_2 = 5*2/2*[l_2^2 l_2*m_2 -l_2^2 -l_2*m_2; l_2*m_2 m_2^2 -l_2*m_2 -m_2^2; -l_2^2 -l_2*m_2 l_2^2 l_2*m_2; -l_2*m_2 -m_2^2 l_2*m_2 m_2^2]

k_2 =

2.5        -2.5         -2.5          2.5         -2.5          2.5          2.5         -2.5         -2.5          2.5          2.5         -2.5          2.5         -2.5         -2.5          2.5