Please answer in Matlab form and explain the variables and process
ENGR&240 Applied Numerical Methods ENGR 240: Applied Numerical Methods Module 2 Programming Assignment (PA2) DUFDATE: Wednesday, January 30. Turn in the printout of your program(s) and output from the programs to th instructor the due date. on that due date, and be prepared to demonstrate your working program on the first class meeting after OBJECTIVES Learn how to write user-defined function m-files . . Learn how to use iterative programming structures. . Learn how to use conditional programming structures Understand the concepts of true error, true relative error, and approximate relative error and how to calculate these measures of numerical accuracy INSTRUCTIONS write a single MATLAB m-file that solves all problems below. You will also want to write additional function m-files as required by the problems and/or as you deem necessary to modularize your code. For each problem, write the requested answers to ASCII data files with the exact filenames specified (e.g "A3.dat"). Your entire asignment should run, running all required m-files and generating all of the required data files, by typing the name of the main m-file at the command prompt in MATLAB. Problem 1 A water tank is designed with a conical section and a cylindrical section and all dimensions related to the radius, R, as shown in the figure below. The light blue section represents the water in the tank with a depth, d. 2R Write a function m-file that accepts the depth, d, of the water and the characteristic dimension, R, of the tank geometry and calculates the total volume of water stored in the tank. Your function should calculate the volume correctly for any depth input and return a value of 999 for the case when d> 3R (i.e. the tank is overflowing). Test your function with the following inputs and save the results to a five element row vector 0.8 1.3 3.8 2.5 0.3 1.25 4.0 Next use your function m-file to calculate the volume for R = 1.5 and values of d ranging from 0 to 5 in increments of 0.1. Save your results to a column vector ANSWERS: Write your results for the test cases to Al.dat (1-5). Write your results for volume versus depth to A2.dat (51 ). Page 1 of 2