Question: (MATLAB) 2. Write a user-defined MATLAB function for the following math function: r(8) = 4cos(4sin8) The input to the function is e (in radians) and
(MATLAB)
2. Write a user-defined MATLAB function for the following math function: r(8) = 4cos(4sin8) The input to the function is e (in radians) and the output is r. Write the function such that e can be a vector. (a) Use the function to calculate r(n/6) and r(51C/6). (b) Use the function to plot (polar plot) r(8) for 0 ?? e ?? 2n.
4. Tables of materials properties list density, in units of kg/m3, when the international system of units (SI) is used and list specific weight, in units of lb/in3, when the U.S. customary system of units are used. Write a user-defmed MATLAB function that converts density to specific weight. For the function name and arguments, use [sw] = DenToSw (den). The input argument den is the density of a material in kg/m3, and the output argument sw is the specific weight in lb/in3. Use the function in the Command Window to: (a) Determine the specific weight of steel whose density is 7860 kg/m3 (b) Determine the specific weight of titanium whose density is 4730 kg/m3
7. The fuel tank shown in the figure in shaped as a frustum of cone with r = 20 in., and H = 2r . Write a user-defined function (for the function name and arguments, use V = Volfuel (y)) that gives the volume of fuel in the tank (in gallons) as a function of the height y (measured from the bottom). Use the function to make a plot of the volume as a function of h for 0 ?? h ?? 40 in. 249
- Write each problem in a separate m file --Total of 6 m files to submit)
- You must write a comment (using % sign) in front or below each line of code explaining what that Matlab command is doing. Your comments should not give any errors at run time.
- Submit the image of all the graphs/plots (if any) in a separate pdf file(s).
- Also, Create a Function of your own which has 3 sub-functions and two anonymous functions somewhere in your function. Your function must take two arrays as iniput and give you three outputs.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
