MatLab Homework
Assignment # 7 Spring 2017
Use MATLAB to solve each problem by writing script files; copy and paste the script file AND the results in the Command Window and/or plot in the Figure Window to a WORD document that has your name and section in the headers of each page and the page number in each footer. Edit the output to remove extra lines and empty spaces. The script files SHOULD have comments for easy readability; take a print out of the Word file and staple before submission.
Due by 3 PM on April 11, 2017.
1. Write a used-defined function that calculates the average and the standard deviation of a list of numbers. Use the function to calculate the average and the standard deviation of the following list of grades: 80 75 91 60 79 89 65 80 95 50 81
Note: The average (or mean) of a given set of n number is given by:
)/n
The standard deviation is given by:
DO not use built-in functions to calculate the mean and the standard deviation.
2. Write a user-defined function that arranges the digits of a given (positive) number in a row vector in the same order as they appear in the number; the function should also arrange the digits in the decimal part in a different vector. For example, if the number is 2645.12, the vectors should be [2 6 4 5] and [1 2]. The whole number can be from 0 to 10 digits long and the decimal part 0 to 6. Check the validity of the function using a few numbers of your choice.
3. A fenced enclosure consists of a rectangle of length L and width 2R, and a semicircle of radius R, as shown in Figure.
2R
L
4. A water tank consists of a cylindrical part of radius r and height h, and a hemispherical top. The tank is to be constructed to hold 500 meter3 of fluid when filled. The cost to construct the cylindrical part of the tank is $300 per square meter of the surface area; the hemispherical part costs $400 per square meter. Determine the radius that results in the least cost and compute the corresponding height and the cost using graphical approach. Verify your results using the calculus approach.
5. A ceramic tile has the design shown in the figure.
The shaded area is painted black and the rest of the
tile is white. The border line between the red and
the white areas follows the equation:
Determine A such that the area of the white and
black colors will be the same.