Please solve all 5 problems on MATLAB and provide code and output.
1 | P a g e
ME 350 Project
Posted November 5th, 2018 due November 19th 2018 Problem 1  Use the function file named NewtonSqrtCS3.m posted on D2L as a starting template to accomplish the following criteria.
1. Change the function name to your surname 2. The long format command is specified to ensure that you can keep high
precision of values of variables. 3. Introduce a variable called it outside the loop and initialize to 0 4. Within the loop update it by 1 5. Modify the statement in the while loop so that it allows you to check the
termination of the loop when the conditional is greater than delta and it is less than maxit
6. Run your function to compute the square root of any prime number between 50 and 100 using a delta value of 5E-3 and maxit of 10.
7. Repeat step 6 with a delta value of 5E-9 and maxit of 12.
Submit: The function file The command line instructions and output of step 6 The command line instructions and output of step 7
Problem 2  Determine the root of f(x) = -0.6×2 + 2.4x + 5.5, in the range 5<x<10, by manually implementing the interval bisection method to compute the first three iterations of root using the bracket rl = 5 and ru = 10. Hint: Use your calculator and the bisection algorithm/flowchart illustrated in the lecture notes for roots of functions. Problem 3  Given the function f(x) = -2×6 – 1.6×4 + 12x +1
(a) Determine the approximate roots of the function graphically Submit your graph
(b) On the basis of your results form (a) apply the bisectrr algorithm directly to compute refined roots
2 | P a g e
Submit the script of the function you use for solving this part of the problem
Problem 4  Consider the square cross-section beam anchored on one end and supporting a 500 lb weight. Other details are shown in figure below. Ref. Musto ch. 6. This problem involves an implementation of f(x) = 0 problems.
According to strength of materials principles, the maximum bending stress experienced by the cantilever beam shown above is:
σ = 335,000/x3 + 92,600/x (1) This reflects the suspended weight, the specific weight (weight per unit length), and the length of the beam. From materials science, the maximum allowable stress (i.e. limiting stress before the onset of yielding) for the beam material is 17,750 psi. We now need to determine the minimum dimension ‘x’ in inches that will satisfy this stress constraint. Solve this problem using four different techniques as itemized below. Hint: The solution approaches involve solving a problem of the form: f(x) = 0
a) Rewrite equation 1 in polynomial form in coefficients of descending powers of x then use the built-in MATLAB function roots to compute the representative solution.
b) Rewrite equation 1 into a MATLAB function file (beam4b.m) which can be used by MATLAB’s fzero function. Use the fzero function to compute the solution for this problem, with an initial guess of 45.
3 | P a g e
c) Rationalize the denominators of the terms in beam4b.m to generate a more standard polynomial form and name it beam4c.m . Use fplot to generate a plot of the function in the range -5≤x≤15; insert grid lines help to spot the approximate location of the real root. Use the fzero function to compute the solution for this problem using and initial guess of -125. Submit the function file; the plot and the solution computed using fzero.
d) Refer to the plot from (c). Use the bisectrr function to compute a root for this function in the interval -5≤x≤5.
i. Comment on the outcome of the attempt in (d). ii. Select an alternative range that would yield the root for this
function. What is the solution?
Problem 5 
In designing a spherical tank whose schematic is shown below, you need to determine the height of water in the tank when the radius R of the tank is 3 m, and the water volume V is 35 m3. The equation for computing V as a function of R and h is:
4 | P a g e
Treat this is an f(h) = 0 problem to compute the height of water in the tank for the given values of V and R
(a) Use fplot directly to generate a plot of the variation of f(h) against h in a
range that helps locate the approximate root. (b) Use fzero directly with the aid of the approximate root from (a) to compute
the desired root accurately Submit:
The MATLAB script you used for (a) and (b) above The plot generated with axis labels and grid lines showing The solution of h echoed to the command window