# Axial Deflection and Stress

## ES 302 Assignment 1

Work the altered version of Problem 2.13 on Page 57 of Beer and Johnston Mechanics of Materials, second edition in the usual way. But first, be sure to change the load at point D to 5 kip. Also calculate the stress in each element. Then work Computer Problem 2.C1, on page 113 in Beer and Johnston. Using either Notepad in Windows 95 or Emacs in Unix, write a Matlab program to find the displacement and stress for the altered Problem 2.13. Don't solve any other problem. Don't use an Input statement, rather, simply code the data directly into the program.

Please follow the suggestions in the textbook of putting the bar horizontal with node 1 at right end and constraining the left end. That is, node 1 will be on the right end and the fixed node 4 will be at the left. However, forces and displacements are measured positively to the right in the usual manner.

Be sure to program your name, date, and subject with lines such as:

```    % print the results
fprintf('\n   Your name, ES 302, ')
disp(date)```
Be careful not to define the symbol disp because the date funtion uses this symbol. Use defl or displ instead. Also, be sure to use 1x3 vectors for element length (len), applied force (f), diameter (dia ), and elastic modulus (ex). You need to distinguish applied nodal forces (f) from the resulting element forces (p)
`       f   = [ 5 -30 20 ]*1e3       % applied forces`
That is, don't start with the calculated elemental forces. Calculate the area and element elongation with one-line Matlab expressions. Do not use a loop. For example:
`    area = pi/4*dia .^2`
Notice the .^ with a dot in the expression. On the other hand, you will need a for loop for calculating the element force and elongation. You will find it easier to run the loop for elongation backward:
`    for i = (nel-1):-1:1`
Print the results in a table with fprinf in a for loop, but don't use the Tab key.
```    for i = 1:nel
fprintf('    %3.0f   %11.3e %5.0f %12.3e \n',i,defl(i),i,str(i))```
Notice that the displacements are for the nodes and the stresses are for the elements. Of course, the displacement of node 4 is zero. Use the f and e formats to control the number of displayed digits. Adjust the number between the % and . to align the decimal points. Print the results with a heading in a table like:
```    Node  Displacement Element  Stress
inches              psi
1   -3.421e-003     1   2.079e+003
2   -6.539e-003     2  -6.288e+003
3   -1.509e-003     3  -1.258e+003```
Be sure the units are shown. Copy the Matlab output data from the screen and paste it into the bottom of your source program. Print your source program with the appended output.

Staple the printout of your source code to your solution obtained by the conventional method and turn it in as usual.

Home, index -- ES Problems -- Matlab Help -- Torsion Problem -- Plane Stress -- Mohr's Circle -- Search

Last revised: March 17, 2000