USE MATLAB For this problem you will repeat the analysis of compressive strength
ID: 3576021 • Letter: U
Question
USE MATLAB
For this problem you will repeat the analysis of compressive strengths that you did for Project 4 using MATLAB instead of C++. New data has been stored in the MATLAB file called CMPSC201P5.mat. Review section 4.1 of Chapter 1 in your textbook and use a command to import this data into MATLAB (do not use the import wizard!) Your code should be designed so it can be used for arrays of different sizes.
Use a MATLAB function to determine the number of formulations (number of rows) and the number of plants (number of columns). Using a single MATLAB command, create a column vector that contains the minimum compressive strength of each formulation. Using a single MATLAB, command create a column vector that contains the maximum compressive strength of each formulation. Using a single MATLAB command determine the average compressive strength for each formulation after removing the minimum and maximum compressive strength for that formulation and store these average values in a column vector. Use a nested loop and a simple if to review each compressive, output a message similar to that given below for those not with range of 15 and 75 MPa inclusive, and count how many compressive strengths were suspect (Do not use any MATLAB built-in functions for this review). Once through the nested loop output how many compressive strengths were suspect.
The value of 14.56 from plant 1 for formulation 8 is suspect.
Create a 2-dimensional array (do not use table command) containing the formulation numbers (1 to the number of formulations), the minimum compressive strengths for each formulation, the maximum compressive strengths for each formulation, and the average compressive strength for each formulation. Using this table and a single fprintf command create output similar to the following:
Formulation __ had a minimum compressive strength of __, a maximum compressive strength of__, and an average compressive strength of __.
The minimum and maximum strengths should be displayed with 1 digit to the right of the decimal whereas the average should be displayed with 2 digits to the right of the decimal.
Do not use the import command to load the data.
31.4800 37.7200 2 54.7400 52.3100 39.9500 53.1000 46.1800 43.3100 46.1400 43.3900 46.1800 26.6300 31.4700 31.2300 31.2500 29.0100 23.3800 29.1500 4 21.9600 24.1400 22.9100 187900 21.1800 16.8500 23.5500 15.4100 21.1800 5 55.7200 56.7600 48.2200 65.7500 61.3000 56.9800 65.4800 53.1500 61.3000 29.8800 29.3400 26.5400 7 74.3700 74.4400 66.5500 70.3100 65.1400 65.5500 69.9700 76.1300 65.1400 8 51.9200 56.4900 54.1000 59.4700 50.6400 55.1300 57.2100 59.4000 50.6400 9 49.7200 42.4300 34.5400 38.2900 36.6900 53.7500 38.9200 457400 36.6900 10 690400 74.4400 66.1800 62.9900 62.8900 724400 69.1100 69.0200 62.8900 35.9400 32.1800 26.7800 12 71.0800 64.2600 70.5200 82.9300 66.6700 70.9400 73.6100 55.4000 52.8200 58.3600 14 61.2100 57.6000 61.9600 62.9600 66.8500 59.2200 56.6400 66.8500 51.4500 27.3700 21.1200 56.7200 50.4800 52.1400 17 61.1000 52.8400 57.9400 56.5300 54.2700 60.5200 59.8500 59.1000 54.2700 18 58 65.3800 63.0500 61.1000 62.0700 61.2100 56.7500 61.1400 62.0700 19 65.5100 65.0600 64.5300 66.4000 61.9900 70.8900 69.5600 67.9400 61.9900 20 69.8600 66.8100 74.0700 69,4700 67.1400 754100 69.1000 67.6400 67.1400Explanation / Answer
Solution:
% load the file data
flA = load('filedata.dat');
flB = [];
Minfl = [];
Maxfl = [];
Avgfl = [];
% code to review each compressive
for ivl=1:length(flA)
MinHere = min(flA(ivl,:));
Minfl(ivl) = MinHere;
fla = flA(ivl,:);
fla = fla(fla~=MinHere);
MaxHere = max(flA(ivl,:));
Maxfl(ivl) = MaxHere;
fla = fla(fla~=MaxHere);
Avgfl(ivl) = mean(fla);
for jvl=1:length(fla)
flB(ivl,jvl) = fla(jvl);
end
end
%code for formulation
[rowsvl,colsvl]=size(flB);
for ivl=1:rowsvl
for jvl=1:colsvl
vlHr = (flB(ivl,jvl));
if (ge(vlHr,15) && le(vlHr,75))
fprintf('The value of %.2f from plant %d formulation %d is suspect. ',flB(ivl,jvl),jvl,ivl);
end
end
end
for ivl=1:length(flA)
fprintf('Formulation %d had fla minimum compressive strength of %.2f, a maximum compressive strength of %.2f, and an average strength of %.2f. ',ivl,Minfl(ivl),Maxfl(ivl),Avgfl(ivl));
end
Output:
The value of 37.08 from plant 1 formulation 1 is suspect.
The value of 37.72 from plant 2 formulation 1 is suspect.
The value of 36.64 from plant 3 formulation 1 is suspect.
The value of 33.38 from plant 4 formulation 1 is suspect.
The value of 35.13 from plant 5 formulation 1 is suspect.
The value of 36.69 from plant 6 formulation 1 is suspect.
The value of 36.64 from plant 7 formulation 1 is suspect.
The value of 52.31 from plant 1 formulation 2 is suspect.
The value of 53.10 from plant 2 formulation 2 is suspect.
The value of 46.18 from plant 3 formulation 2 is suspect.
The value of 43.81 from plant 4 formulation 2 is suspect.
The value of 46.14 from plant 5 formulation 2 is suspect.
The value of 43.39 from plant 6 formulation 2 is suspect.
The value of 46.18 from plant 7 formulation 2 is suspect.
The value of 26.63 from plant 1 formulation 3 is suspect.
The value of 31.47 from plant 2 formulation 3 is suspect.
The value of 31.23 from plant 3 formulation 3 is suspect.
The value of 31.25 from plant 4 formulation 3 is suspect.
The value of 29.01 from plant 5 formulation 3 is suspect.
The value of 29.15 from plant 6 formulation 3 is suspect.
The value of 29.01 from plant 7 formulation 3 is suspect.
The value of 21.96 from plant 1 formulation 4 is suspect.
The value of 22.91 from plant 2 formulation 4 is suspect.
The value of 18.79 from plant 3 formulation 4 is suspect.
The value of 21.18 from plant 4 formulation 4 is suspect.
The value of 16.85 from plant 5 formulation 4 is suspect.
The value of 23.55 from plant 6 formulation 4 is suspect.
The value of 21.18 from plant 7 formulation 4 is suspect.
The value of 55.72 from plant 1 formulation 5 is suspect.
The value of 56.76 from plant 2 formulation 5 is suspect.
The value of 61.30 from plant 3 formulation 5 is suspect.
The value of 56.98 from plant 4 formulation 5 is suspect.
The value of 65.48 from plant 5 formulation 5 is suspect.
The value of 53.15 from plant 6 formulation 5 is suspect.
The value of 61.30 from plant 7 formulation 5 is suspect.
The value of 29.59 from plant 1 formulation 6 is suspect.
The value of 29.03 from plant 2 formulation 6 is suspect.
The value of 31.28 from plant 3 formulation 6 is suspect.
The value of 31.25 from plant 4 formulation 6 is suspect.
The value of 29.88 from plant 5 formulation 6 is suspect.
The value of 29.34 from plant 6 formulation 6 is suspect.
The value of 74.37 from plant 1 formulation 7 is suspect.
The value of 74.44 from plant 2 formulation 7 is suspect.
The value of 66.55 from plant 3 formulation 7 is suspect.
The value of 70.31 from plant 4 formulation 7 is suspect.
The value of 65.55 from plant 5 formulation 7 is suspect.
The value of 69.97 from plant 6 formulation 7 is suspect.
The value of 51.92 from plant 1 formulation 8 is suspect.
The value of 56.49 from plant 2 formulation 8 is suspect.
The value of 54.10 from plant 3 formulation 8 is suspect.
The value of 55.13 from plant 4 formulation 8 is suspect.
The value of 57.21 from plant 5 formulation 8 is suspect.
The value of 59.40 from plant 6 formulation 8 is suspect.
The value of 49.72 from plant 1 formulation 9 is suspect.
The value of 42.43 from plant 2 formulation 9 is suspect.
The value of 38.29 from plant 3 formulation 9 is suspect.
The value of 36.69 from plant 4 formulation 9 is suspect.
The value of 38.92 from plant 5 formulation 9 is suspect.
The value of 45.74 from plant 6 formulation 9 is suspect.
The value of 36.69 from plant 7 formulation 9 is suspect.
The value of 69.04 from plant 1 formulation 10 is suspect.
The value of 66.18 from plant 2 formulation 10 is suspect.
The value of 62.99 from plant 3 formulation 10 is suspect.
The value of 72.44 from plant 4 formulation 10 is suspect.
The value of 69.11 from plant 5 formulation 10 is suspect.
The value of 69.02 from plant 6 formulation 10 is suspect.
The value of 35.10 from plant 1 formulation 11 is suspect.
The value of 29.46 from plant 2 formulation 11 is suspect.
The value of 28.99 from plant 3 formulation 11 is suspect.
The value of 31.48 from plant 4 formulation 11 is suspect.
The value of 32.18 from plant 5 formulation 11 is suspect.
The value of 26.78 from plant 6 formulation 11 is suspect.
The value of 71.08 from plant 1 formulation 12 is suspect.
The value of 64.26 from plant 2 formulation 12 is suspect.
The value of 70.52 from plant 3 formulation 12 is suspect.
The value of 73.61 from plant 4 formulation 12 is suspect.
The value of 66.67 from plant 5 formulation 12 is suspect.
The value of 70.94 from plant 6 formulation 12 is suspect.
The value of 73.61 from plant 7 formulation 12 is suspect.
The value of 54.67 from plant 1 formulation 13 is suspect.
The value of 53.24 from plant 2 formulation 13 is suspect.
The value of 47.82 from plant 3 formulation 13 is suspect.
The value of 51.45 from plant 4 formulation 13 is suspect.
The value of 55.40 from plant 5 formulation 13 is suspect.
The value of 52.82 from plant 6 formulation 13 is suspect.
The value of 61.21 from plant 1 formulation 14 is suspect.
The value of 57.60 from plant 2 formulation 14 is suspect.
The value of 61.96 from plant 3 formulation 14 is suspect.
The value of 62.96 from plant 4 formulation 14 is suspect.
The value of 59.22 from plant 5 formulation 14 is suspect.
The value of 56.64 from plant 6 formulation 14 is suspect.
The value of 31.06 from plant 1 formulation 15 is suspect.
The value of 23.78 from plant 2 formulation 15 is suspect.
The value of 29.88 from plant 3 formulation 15 is suspect.
The value of 27.37 from plant 4 formulation 15 is suspect.
The value of 26.41 from plant 5 formulation 15 is suspect.
The value of 23.38 from plant 6 formulation 15 is suspect.
The value of 50.48 from plant 1 formulation 16 is suspect.
The value of 52.14 from plant 2 formulation 16 is suspect.
The value of 46.59 from plant 3 formulation 16 is suspect.
The value of 47.18 from plant 4 formulation 16 is suspect.
The value of 51.30 from plant 5 formulation 16 is suspect.
The value of 47.17 from plant 6 formulation 16 is suspect.
The value of 46.59 from plant 7 formulation 16 is suspect.
The value of 57.94 from plant 1 formulation 17 is suspect.
The value of 56.53 from plant 2 formulation 17 is suspect.
The value of 54.27 from plant 3 formulation 17 is suspect.
The value of 60.52 from plant 4 formulation 17 is suspect.
The value of 59.85 from plant 5 formulation 17 is suspect.
The value of 59.10 from plant 6 formulation 17 is suspect.
The value of 54.27 from plant 7 formulation 17 is suspect.
The value of 58.00 from plant 1 formulation 18 is suspect.
The value of 63.05 from plant 2 formulation 18 is suspect.
The value of 61.10 from plant 3 formulation 18 is suspect.
The value of 62.07 from plant 4 formulation 18 is suspect.
The value of 61.21 from plant 5 formulation 18 is suspect.
The value of 61.14 from plant 6 formulation 18 is suspect.
The value of 62.07 from plant 7 formulation 18 is suspect.
The value of 65.51 from plant 1 formulation 19 is suspect.
The value of 65.06 from plant 2 formulation 19 is suspect.
The value of 64.53 from plant 3 formulation 19 is suspect.
The value of 66.40 from plant 4 formulation 19 is suspect.
The value of 69.56 from plant 5 formulation 19 is suspect.
The value of 67.94 from plant 6 formulation 19 is suspect.
The value of 69.86 from plant 1 formulation 20 is suspect.
The value of 74.07 from plant 2 formulation 20 is suspect.
The value of 69.47 from plant 3 formulation 20 is suspect.
The value of 67.14 from plant 4 formulation 20 is suspect.
The value of 69.10 from plant 5 formulation 20 is suspect.
The value of 67.64 from plant 6 formulation 20 is suspect.
The value of 67.14 from plant 7 formulation 20 is suspect.
Formulation 1 had a minimum compressive strength of 31.48, a maximum compressive strength of 39.67, and an average strength of 36.18.
Formulation 2 had a minimum compressive strength of 39.95, a maximum compressive strength of 54.74, and an average strength of 47.30.
Formulation 3 had a minimum compressive strength of 23.38, a maximum compressive strength of 31.89, and an average strength of 29.68.
Formulation 4 had a minimum compressive strength of 15.41, a maximum compressive strength of 24.14, and an average strength of 20.92.
Formulation 5 had a minimum compressive strength of 48.22, a maximum compressive strength of 65.75, and an average strength of 58.67.
Formulation 6 had a minimum compressive strength of 26.54, a maximum compressive strength of 32.51, and an average strength of 30.06.
Formulation 7 had a minimum compressive strength of 65.14, a maximum compressive strength of 76.13, and an average strength of 70.20.
Formulation 8 had a minimum compressive strength of 50.64, a maximum compressive strength of 59.47, and an average strength of 55.71.
Formulation 9 had a minimum compressive strength of 34.54, a maximum compressive strength of 53.75, and an average strength of 41.21.
Formulation 10 had a minimum compressive strength of 62.89, a maximum compressive strength of 74.44, and an average strength of 68.13.
Formulation 11 had a minimum compressive strength of 23.98, a maximum compressive strength of 35.94, and an average strength of 30.67.
Formulation 12 had a minimum compressive strength of 64.17, a maximum compressive strength of 82.93, and an average strength of 70.10.
Formulation 13 had a minimum compressive strength of 47.27, a maximum compressive strength of 58.36, and an average strength of 52.57.
Formulation 14 had a minimum compressive strength of 51.45, a maximum compressive strength of 66.85, and an average strength of 59.93.
Formulation 15 had a minimum compressive strength of 21.12, a maximum compressive strength of 31.31, and an average strength of 26.98.
Formulation 16 had a minimum compressive strength of 44.83, a maximum compressive strength of 56.72, and an average strength of 48.78.
Formulation 17 had a minimum compressive strength of 52.84, a maximum compressive strength of 61.10, and an average strength of 57.50.
Formulation 18 had a minimum compressive strength of 56.75, a maximum compressive strength of 65.38, and an average strength of 61.23.
Formulation 19 had a minimum compressive strength of 61.99, a maximum compressive strength of 70.89, and an average strength of 66.50.
Formulation 20 had a minimum compressive strength of 66.81, a maximum compressive strength of 75.41, and an average strength of 69.20.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.