Using Matlab, set up a computer program as described in Problem 3.C1, on page 181 in Beer and Johnston Mechanics of Materials, second edition. However, only work Problems 3.8 (the rotation) and 3.30 (the stress) which are different aspects of the same problem. The lengths and shear modulus are given in 3.30. Begin with the previous problem, since the formulas are similar. But change the symbols. For example, use tn for nodal torque and te for elemental torque. Copy the previous problem
cp old.m new.m(in Unix) and edit the copy. As before don't use an Input statement, rather, simply code the data directly into the program.
Please follow the suggestions in the textbook of putting node 1 at free end and node 5 at the constrained end. However, torques and rotations are measured according to the right-hand rule as usual.
Be sure to program your name, date, and subject with lines such as:
% print the results fprintf('\n Torsional Load, Problem 3.8 and 3.30') fprintf('\n Your name, ES 302, ') disp(date)Also, be sure to use 1x4 vectors for element length (len), nodal torque (te), OD (diao), ID (diai), and shear modulus (gxy). You need to distinguish applied nodal torques from element torques
tn = [ 15 -60 -90 120 ] % applied torquesThat is, don't start with the calculated elemental torques. Calculate the polar moment of inertia, area, and element rotation with one-line Matlab expressions. Do not use a loop. For example:
j = pi/32*(diao .^4 - diai .^4)Notice the .^ with a dot in the expression. On the other hand, you will need a for loop for calculating the element torque and rotation. Alternatively, you can use the cumsum Matlab function with a fliplr functions on either side to do it without a loop. You will find it easier to run the loop for rotation backward:
for i = (nel-1):-1:1Print the results in a table with fprinf in a for loop.
for i = 1:nel fprintf(' %?.0f %?.3f %?.0f %?.3e \n',i,rotn(i),i,str(i))Notice that the rotations are for the nodes and the stresses are for the elements. Of course, the rotation 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 that starts like:
Node Rotation Element Stress degrees MPa 1 -0.247 1 76.39 2 -1.611 2 -67.91Copy 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.
Make a plot of torsional rotation vs. node number with title, grid, and x and y labels using the plot, title, xlabel, ylabel, and grid commands. Because the node numbers are consecutive integers, you only need the rotation vector in the plot command. Print the plot.
Staple the printouts of your source code and the plot to your solution obtained by the conventional method and turn it in as usual.
Home, index -- ES Problems -- Matlab Help -- Axial Problem -- Plane Stress -- Mohr's Circle -- Search
Last revised: March 17, 2000