Question
Programming Problem: For this problem, you are to create a script that will perform calculations for a set of laboratory test measurements of rock strength
Programming Problem:
For this problem, you are to create a script that will perform calculations for a set of laboratory test measurements of rock strength and output the results to the MATLAB command window in tabular format. The laboratory test measurements are stored in a MATLAB "mat file" (assign7_data.mat Download assign7_data.mat). You should load the data from this mat file into MATLAB (preferably programmatically) and then develop a MATLAB script to perform the calculations described below. The results of the calculations should then be output to the MATLAB Command Window in three different tables as described.
Data File:
The MATLAB mat file includes measurements and information from 53 different tests, stored in ten different arrays. All tests are for cylindrical test specimens with dimensions provided in the arrays. The arrays include:
boring - a string array containing the name of the boring for each test specimen (each array element is a character string) depth_ft - an array containing the depths of each test specimen in units of feet diam_in - an array containing the diameter of each cylindrical test specimen in units of inches disp_in - an array containing the axial displacement of each test specimen at failure in units of inches height_in - an array containing the initial height of each test specimen in units of inches mass_g - an array containing the mass of each test specimen in units of grams s1_psi - an array containing the axial stress at failure for each test specimen in units of psi (pounds per square inch) s3_psi - an array containing the lateral stress at failure for each test specimen in units of psi. Note that some values in this array are shown as "NaN" (indicating not a number) because the lateral stress is zero and was not measured. testnum - an array containing uint16 numbers indicating the test number testtype - a string array containing text designating a test type. Two test types are indicated: a "UU" test and a "UC" test.
Calculations:
You are to develop a MATLAB script file that will calculate the specimen density (in units of g/cc...grams per unit centimeter), the specimen strength (in units of psi), the specimen modulus (in units of psi), and the strain at failure (in percent). Equations for each of these values are as follows:
specimen density should be calculated as: p=m/v=(m).(h*A) where p is density, m is mass (stored in array mass_g), v is volume, is specimen height (stored in array height_in), and A is the specimen area (=pi((d^2)/(4)) where d is the specimen diameter (stored in array diam_in). Note that the values provided for height and diameter are in units of inches, which must be converted to units of centimeters in order to produce the correct units for density.
specimen strength should be calculated differently for UU tests and UC tests (according to values in array testtype)
specimen strength for UU tests: sigma c=sigma1sigma3 where Sigma c is the specimen strength, sigma 1 is the axial stress (stored in array s1_psi) and sigma 3 is the lateral stress (stored in array s3_psi).
specimen strength for UC tests: sigma c=sigma 1 where sigma c is the specimen strength and sigma 1 is the axial stress (stored in array s1_psi).
specimen strain should be calculated as: Ef=gamma * where Ef is strain, gamma is displacement at failure (stored in array disp_in), and is specimen height (stored in array height_in) . Note that this equation will produce a dimensionless, decimal value of strain (which you will need for calculating modulus), but that you should output the magnitude of strain in percent (i.e., this value times 100).
specimen modulus should also be calculated differently for UU tests and UC tests (according to values in array testtype)
specimen modulus for UU tests: E=(sigma 1sigma 3)/Ef where E is specimen modulus, sigma 1 is the axial stress (stored in array s1_psi) and sigma 3 is the lateral stress (stored in array s3_psi), and Ef is the specimen strain calculated as shown in item 3 above (the dimensionless, decimal value)
specimen strength for UC tests: E=sigma1 / Ef where sigma 1 is the axial stress (stored in array s1_psi)
Calculated values for specimen density, strain, modulus, and strength should be stored in separate arrays, with each element containing values corresponding to the respective elements of the provided arrays (i.e., the first element of the calculated arrays should correspond to the data provided in the first element of the arrays in the mat file, the second element of the calculated arrays should correspond to the data provided in the second element of the arrays in the mat file, etc.).
Output:
Once you have calculated values for density, strain, modulus, and strength for each provided data set, you should output the data to the Command Window in three separate tables according to the strain level for each test. All three tables should include headings for (1) the specimen number, (2) Density (in g/cc), (3) Strength (in psi), (4) Modulus (in psi), and (5) Strain (in %). The first table should show the calculated results for specimens with strain less than or equal to 3% and should be referred to as "High Quality Specimens". The second table should show the calculated results for specimens with strain greater than 3% and less than or equal to 5% and should be referred to as "Medium Quality Specimens". The third table should show the calculated results for specimens with strain greater than 5%. An example of the output is shown below:
When done, upload your MATLAB script file, named according to the usual convention, using the upload button below.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started