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

MATLAB Assignment The Two Bar Truss With Variable Material Properties

Two Bar Truss Problem Overview
In all of the previous MATLAB Assignments, the modulus of elasticity, and the cross sectional area of an element in a truss system have been constant. In reality however, this may not always be the case. The modulus of elasticity and the cross sectional area may vary with length in an element.

In this problem, a truss system is composed of two elements. In the elements, the modulus of elasticity and cross sectional area vary linearly in the element.

This problem uses much of the same code as the original two bar truss problem.

The following data was given for the problem:

for element 1 e(1)1=10      modulus of elasticity at end 1 e(1)2=20      modulus of elasticity at end 2 A(1)1=15      cross section area at end 1 A(1)2=25      cross section area at end 2 L(1) = 4      length of element 1 for element 2 e(2)1=1       modulus of elasticity at end 1 e(2)2=2       modulus of elasticity at end 2 A(2)1=14      cross section area at end 1 A(2)2=25      cross section area at end 2 L(2) = 2      length of element 2 P = 7N    (Applied load)

MATLAB Code
The following MATLAB code is used to solve this problem:

Additional Functions
The above code uses three separate MATLAB mfiles as functions. These are PlaneTrussElement, PlaneTrussResults, and NodalSoln.

A complete description of these functions can be seen here

Comments On The Code
This problem is nearly identical to the original two bar truss problem, with the exception of the Young's moduli and cross sectional areas. Each of those properties vary along each bar. The values of those properties were given for each end of each bar. The properties were assumed to vary linearly across the length of the bars.

To be able to use the property values, and average value was found. This was accomplished by adding the properties at each end and then dividing by the length of the bar. For example: the average cross sectional area for element 1 was found by

$$ \frac{(A^{(1)}_1 +A^{(1)}_2)}{L^{(1)}}$$

where $$A^{(1)}_1$$ and $$A^{(1)}_2$$ are the cross sectional areas of element 1 at local nodes 1 and 2 respectively, and $$L^{(1)}$$ is the length of element 1.

These averages were saved and used in the same manner(but in place of) the constant properties in the original problem.

To plot the truss system, two matrices of the nodal locations were created, one for the undeformed locations, and the second for the displaced node locations. Then lines were drawn to connect the nodes for the undeformed and deformed cases.

To compare the casde of a truss with elements with variable moduli of elasticity and cross sectional areas, the original two bar truss code was added to the end of the code. The original truss code overrides the existing data, and uses the same plotting code as used earlier to plot the deformed truss with constant properties.

A legend is then created to distinguish the seperate truss systems.

Results Output
Running the above MATLAB code generates the following output:

Comments On The Results Output
The MATLAB output for this program gives the local and global element stiffness matrices (k_local and k) for elements 1 and 2, and the global stiffness matrix for the entire system (K). The output then shows the applied loads R, which was an upward force of 7 N applied at global node 2. The displacement matrix d shows the distances that the nodes are displaced under the load. In this problem, nodes 1 and 3 are constrained, so their displacements are zero in both the x and y directions. The non-zero displacements are those of node 2. Looking at the figure and the data output, it is obvious that node 2 moves upward and to the left. The reactions matrix gives the horizontal and vertical reaction forces at the constrained points. The results matrix shows the strain, stress and axial forces of each element in columns in that order, with the values for element 1 being in row 1 and the values for element 2 in row 2.

Note : all of the output for the original truss problem (with constant properties) has been suppressed. To see the results, click here

Figure
Running the above MATLAB code generates the following figure.



In the figure, the red dotted lines represent the undeformed truss, the blue solid lines show the deformed truss with the variable material properties, and the green solid lines represent the deformed truss with the constant material properties.

The node and element identifiers were created manually using Paint after running the MATLAB code.