.M

Programming Assignment 2 Solution

You will need to submit your program on Learn for grading. The name of the file should be cs151su17assn2.m. Be sure to include your name and section number as comments in the mfile.
A cable of length Lc supports a beam of length Lb, so that it is horizontal when the weight W is attached at the beam end. The principles of statics can be used to show that the tension force T in the cable is given by:
2 2 D L D
L L W
T
b
b c

where D is the distance of the cable attachment point to the beam pivot.
A Step-by-step Procedure
1. Assign single values to the variables representing the cable length (Lc), the length of the beam (Lb) and the weight (W): 4.80 meters, 3.98 meters and 350 Newtons.
2. The distance of the cable attachment point will be a matrix of random values. This will be a one row, twenty column matrix that contains values starting at 0.1 and going up to length of the beam minus 0.1. HINT: use .
3. Sort the distance values in ascending order.
4. Determine the tension using the equation given.
5. Find the minimum tension and the location of the minimum tension.
6. Print out the minimum tension.
7. Create a table of the distance values: the one before the minimum tension, the one where the minimum tension occurs and the one after the minimum tension. Refer to the lecture given on using max and min with multiple return values as a resource to determine how to do this.
Your output should look similar to the following (please note that you will be using the random number generator so the values may be different).
Also, run the program multiple times and determine an approximate value of the distance where the minimum tension occurs. Store your approximation as a comment in the code of the program. These values shown are approximations to the values you should be getting.
minT = 863.3024
table = 2.4903 3.0945 3.1251